Print simple timing information. More...
#include <util.h>
Public Member Functions | |
timer (const char *msg, int lvl=1) | |
Constructor. More... | |
~timer () | |
Destructor. More... | |
Print simple timing information.
It starts the clock in the constructor, stops the clock in the destructor, and reports the CPU time and elapsed time in between. Typically one would declare an object of this class in a block of code, and let the object be cleaned up by compiler generated code at the end of its scope. Upon destruction of this object, it prints its lifespan. To distiguish the different time durations, the user should provide a meaningful description to the constructor.
|
explicit |
Constructor.
The caller must provide a message string. If ibis::gVerbose is no less than lvl, it will create an ibis::horometer object to keep the time and print the duration of the timer in the destructor. If ibis::gVerbose is no less than lvl+2, it will also print a message from the constructor.
References ibis::horometer::start(), and timer().
Referenced by timer().
ibis::util::timer::~timer | ( | ) |
Destructor.
It reports the time elapsed since the constructor was called. Use ibis::horometer directly if more control on the timing information is desired.