Ember
|
A high-resolution, thread-aware timer and call counter class. More...
#include <perfTimer.h>
Public Member Functions | |
PerfTimer () | |
~PerfTimer () | |
void | start () |
Start accumulating time, and increment the call counter. | |
void | stop () |
Stop accumulating time. | |
void | reset () |
Reset the accumulated time. | |
void | resume () |
Starts accumulating time without incrementing callCount. | |
double | getTime () const |
Get the elapsed time in seconds. | |
unsigned long int | getCallCount () const |
Get the total call count. | |
Private Attributes | |
tbb::combinable< unsigned long int > | callCount |
tbb::combinable< unsigned long int > | cumulativeTime |
tbb::enumerable_thread_specific< timeval > | t1 |
A high-resolution, thread-aware timer and call counter class.
Uses OS- specific timers to get better precision (typically microsecond or better resolution) than the cross- platform clock
function which typically has a resolution on the order of 10 ms. Multiple threads may independently start() and stop() the same timer. The reported elapsed time will be the sum of the elapsed time from each thread.
PerfTimer::PerfTimer | ( | ) |
|
inline |
void PerfTimer::start | ( | ) |
Start accumulating time, and increment the call counter.
void PerfTimer::stop | ( | ) |
Stop accumulating time.
void PerfTimer::reset | ( | ) |
Reset the accumulated time.
void PerfTimer::resume | ( | ) |
Starts accumulating time without incrementing callCount.
double PerfTimer::getTime | ( | ) | const |
Get the elapsed time in seconds.
unsigned long PerfTimer::getCallCount | ( | ) | const |
Get the total call count.
|
private |
|
private |
|
private |