A class for recording CPU and wall clock time.
More...
#include <timer.hpp>
|
| Timer () |
| Construct unnamed timer. More...
|
|
| Timer (const std::string &tname) |
| Construct a named timer. More...
|
|
| Timer (const std::string &tname, const Timer *_ratio_timer) |
| Construct a named timer with ratio timer. More...
|
|
void | start () |
| Start accumulating time at current time, resetting elapsed times. More...
|
|
void | stop () |
| Stop accumulating times and add them to elapsed times. More...
|
|
void | resume () |
| Start accumulating time without resetting elapsed times. More...
|
|
void | report (bool show_cpu) const |
| Reports the elapsed times and ratios if applicable. More...
|
|
A class for recording CPU and wall clock time.
CMR::Timer::Timer |
( |
const std::string & |
tname | ) |
|
CMR::Timer::Timer |
( |
const std::string & |
tname, |
|
|
const Timer * |
_ratio_timer |
|
) |
| |
Construct a named timer with ratio timer.
In the presence of a ratio_timer, calls to profile will report elapsed time(s) as a fraction of those from ratio_timer.
void CMR::Timer::report |
( |
bool |
show_cpu | ) |
const |
Reports the elapsed times and ratios if applicable.
If show_cpu
is true, cpu_elapsed will be reported as well. If not, only wall_elapsed will be reported. Generally show_cpu should be false
unless the process spawns multiple threads.
void CMR::Timer::resume |
( |
| ) |
|
Start accumulating time without resetting elapsed times.
void CMR::Timer::start |
( |
| ) |
|
Start accumulating time at current time, resetting elapsed times.
void CMR::Timer::stop |
( |
| ) |
|
Stop accumulating times and add them to elapsed times.
double CMR::Timer::cpu_elapsed |
|
private |
double CMR::Timer::cpu_end |
|
private |
double CMR::Timer::cpu_start |
|
private |
const Timer* CMR::Timer::ratio_timer |
|
private |
For use by report to report elapsed times as ratio of other timer.
If ratio_timer
is not nullptr
, then a call to report will also report wall_elapsed and cpu_elapsed as a ratio of those respective values from ratio_timer.
std::string CMR::Timer::timer_name |
|
private |
The name of the Timer.
timer_name will be used by report to identify the time(s) printed. For most nicely formatted output, keep timer_name at 20 chars or less.
std::chrono::duration<double> CMR::Timer::wall_elapsed |
|
private |
Elapsed wall clock or stopwatch time.
std::chrono::time_point<std::chrono::system_clock> CMR::Timer::wall_end |
|
private |
std::chrono::time_point<std::chrono::system_clock> CMR::Timer::wall_start |
|
private |
The documentation for this class was generated from the following files: