libcommonc++
0.7
|
A stopwatch-style timer. More...
#include <StopWatch.h++>
Public Member Functions | |
StopWatch () | |
Construct a new StopWatch. More... | |
virtual | ~StopWatch () |
Destructor. More... | |
void | start () |
Start the timer. More... | |
void | stop () |
Stop the timer. More... | |
void | pause () |
Pause the timer. More... | |
void | resume () |
Resume the timer. More... | |
void | reset () |
Reset the timer. More... | |
uint64_t | elapsedKernelTime () const |
Return the total elapsed kernel time for this timer (up to the point where the timer was last stopped) in milliseconds. More... | |
uint64_t | elapsedUserTime () const |
Return the total elapsed user time for this timer (up to the point where the timer was last stopped) in milliseconds. More... | |
uint64_t | elapsedRealTime () const |
Return the total elapsed real time for this timer (up to the point where the timer was last stopped) in milliseconds. More... | |
bool | isRunning () const |
Determine if this timer is running. More... | |
A stopwatch-style timer.
The timer can be used for code benchmarking and other timing tasks. The timer accumulates time while it is "running"; this accumulated time (in kernel time, user time, and real time) can be queried while the timer is stopped.
|
virtual |
Destructor.
|
inline |
Return the total elapsed kernel time for this timer (up to the point where the timer was last stopped) in milliseconds.
|
inline |
Return the total elapsed real time for this timer (up to the point where the timer was last stopped) in milliseconds.
|
inline |
Return the total elapsed user time for this timer (up to the point where the timer was last stopped) in milliseconds.
|
inline |
Determine if this timer is running.
|
inline |
Pause the timer.
Attempting to pause a timer that isn't running will have no effect. Equivalent to stop().
void reset | ( | ) |
Reset the timer.
All elapsed times are cleared to 0.
|
inline |
Resume the timer.
Attempting to resume a timer that isn't paused will have no effect. Equivalent to start().
void start | ( | ) |
Start the timer.
Attemping to start an already running timer will have no effect.
void stop | ( | ) |
Stop the timer.
Attempting to stop a timer that isn't running will have no effect.