A timer t of type Timer is an object with a state. It is either running or it is stopped. The state is controlled with t.start() and t.stop() . The timer counts the time elapsed since its creation or last reset. It counts only the time where it is in the running state. The time information is given in seconds. The timer counts also the number of intervals it was running, i.e. it counts the number of calls of the start() member function since the last reset. If the reset occures while the timer is running it counts as the first interval.
#include <CGAL/Timer.h>
| |
state is stopped.
|
|
| Precondition: state is stopped. |
|
| Precondition: state is running. |
|
| reset timer to zero. The state is unaffected. |
|
| true if the current state is running. |
|
| user process time in seconds. |
|
| number of start/stop-intervals since the last reset. |
|
| smallest possible time step in seconds. |
|
| maximal representable time in seconds. |
The timer class is based in the C function std::clock(...) which measures the user and system times of the current process and its subprocesses. The time granularity is reasonable fine with currently 10 ms on IRIX and Solaris. However the counter wraps around after only about 36 minutes. On Solaris machines the man page states that the timer could fail. In that case an error message is printed and the program aborted.