cisst-saw
|
#include <osaStopwatch.h>
Public Types | |
typedef unsigned long | MillisecondsCounter |
typedef double | SecondsCounter |
Public Member Functions | |
osaStopwatch (void) | |
double CISST_EXPORT | GetTimeGranularity (void) const |
void | Reset (void) |
void | Start (void) |
void | Stop (void) |
bool | IsRunning (void) const |
MillisecondsCounter CISST_DEPRECATED | GetCurrentRead (void) const |
SecondsCounter | GetElapsedTime (void) const |
Implement a simple stopwatch mechanism, which is helpful in profiling, debugging, and performance estimation.
The osaStopwatch class uses system calls to obtain time at the finest granularity available in the system. Note that a system call may sometimes invoke a context switch, and use them only when needed to interfere the least with the normal performance of the program.
To reduce overhead (for more efficient time polling), all the methods are inlined.
typedef unsigned long osaStopwatch::MillisecondsCounter |
typedef double osaStopwatch::SecondsCounter |
|
inline |
|
inline |
Return the current read of the stopwatch without changing the running state. This method is now deprecated as it returns a time interval in milliseconds (integer). Use GetElapsedTime() instead.
|
inline |
Return the current read of the stopwatch without changing the running state. Return a time interval in seconds using a "double" precision floating point number.
double CISST_EXPORT osaStopwatch::GetTimeGranularity | ( | void | ) | const |
Return the granularity of time in the system, in seconds. The fraction part is the fraction of second that the system time granularity supports
|
inline |
Returns true if the stopwatch is running and counting continues (i.e., if Start was called last). Returns false if the watch is stopped, i.e., if Stop or Reset was called last.
|
inline |
Reset all the counters to zero, and stop the watch
|
inline |
Start the stopwatch from its current counter state. If the watch is already running, do nothing
|
inline |
Stop the stopwatch so that its counter state is kept until a Start or a Reset