col::NanoTimer Class Reference

Timer with nanoseconds resolution. More...

Collaboration diagram for col::NanoTimer:

Collaboration graph
[legend]
List of all members.

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.

Detailed Description

Timer with nanoseconds resolution.

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!

See also:
Todo:


Constructor & Destructor Documentation

col::NanoTimer::NanoTimer ( void   ) 

Create a new timer with nanoseconds resolution.

Saves the current time stamp, too.

Sideeffects:
See checkFrequency().


Member Function Documentation

bool col::NanoTimer::usesHighFrequ ( void   )  [static]

Tells whether or not the NanoTimer use the high frequency counter.

Warning:
Valid only after the first NanoTimer has been created!

double col::NanoTimer::frequ ( void   )  [static]

Returns the frequency (resolution) of the counter in GHz.

Warning:
Valid only if NanoTimer::usesHighFrequ() = true !


The documentation for this class was generated from the following files:
Generated on Tue Oct 16 18:13:11 2007 for CollDet by  doxygen 1.5.2