Collaboration diagram for col::NanoTimer:
Timers, timing, sleeping, etc. | |
NanoTimer () | |
Create a new timer with nanoseconds resolution. | |
void | start (void) |
Save the current time (stamp) in the timer. | |
double | elapsed (void) const |
Return the time elapsed since the last start() in nanoseconds. | |
static bool | usesHighFrequ (void) |
Tells whether or not the NanoTimer use the high frequency counter. | |
static double | frequ (void) |
Returns the frequency (resolution) of the counter in GHz. |
The units of this timer are always nanoseconds, but on some platforms, the actual resolution might be less (microseconds or even less).
Where implemented, this class uses the high-speed, high-performance, hardware timers/counters. Otherwise, we just use gettimeofday(), which, at least on Linux/Pentium, has microsecond resolution.
Currently, the time is wall-clock time, not user time!
col::NanoTimer::NanoTimer | ( | void | ) |
Create a new timer with nanoseconds resolution.
Saves the current time stamp, too.
bool col::NanoTimer::usesHighFrequ | ( | void | ) | [static] |
double col::NanoTimer::frequ | ( | void | ) | [static] |
Returns the frequency (resolution) of the counter in GHz.