Horometer -- a primitive timing instrument. More...
#include <horometer.h>
Public Member Functions | |
double | CPUTime () const |
Return the CPU time in seconds. | |
double | realTime () const |
Return the elapsed time in seconds. | |
void | resume () |
Continue after being stopped. | |
void | start () |
Start the timer. Clear the internal counters. | |
void | stop () |
Stop the timer. Record the duration. May resume later. |
Horometer -- a primitive timing instrument.
This is intented to be a simple timer that measure a single duration. It must be explicitly started by calling the function start. The same function start may be called to restart the timer which will discard the previous starting point. The function stop must be called before functions realTime and CPUTime can report correct time values. After a horometer is stopped, it may continue by calling start to count a new duration, or it may add to the existing duration by calling resume.
Timing accuracy depends on the underlying implementation. On most unix systems, the time resolution is about 0.01 seconds. The timing function itself may take ~10,000 clock cycles to execute, which is about 30 microseconds on a 400 MHz machine.
![]() |