rasdaman complete source
|
Module: { raslib}. More...
#include <rmdebug.hh>
Public Member Functions | |
RMTimer (const char *newClass, const char *newFunc, int newBmLevel=0) | |
constructor, initializes members and starts timer. More... | |
~RMTimer () | |
destructor, calls stop(). More... | |
void | setOutput (int newOutput) |
switch output on RMInit::bmOut on and off. More... | |
void | pause () |
pauses timer. More... | |
void | resume () |
resumes timer. More... | |
void | start () |
resets timer. More... | |
void | stop () |
prints time spent if output is TRUE. More... | |
int | getTime () |
delivers current time count. More... | |
Module: { raslib}.
RMTimer is not strictly part of RasLib. It is a class used for taking timing measurements if configuring with –benchmark-enabled. One way of using it is to put the following at the beginning of a function:
{ RMTIMER("className", "functionName");}
If RMANBENCHMARK is defined this is expanded to:
{ RMTimer localRMTimer = RMTimer("className", "functionName");}
Time is taken between this line and exiting the block where this line was. For more elaborate timing measurements an RMTimer object can be used directly. All timing information is stored in the object, so multiple RMTimer objects can be used at the same time.
If output is generated on RMInit::bmOut depends on the flag { output} and the benchmark level. Output is generated if { output} is TRUE and { bmLevel} is lower than the global benchmark level stored in RManBenchmark. The flag { output} can be changed with setOutput(). The function start() sets { output} to TRUE, stop() sets { output} to FALSE.
{ Important}: If a RMTimer is used as a static variable, it must be ensured that no output is generated in the destructor either by calling stop() or by manually setting { output} to FALSE using setOutput() before termination of the program. The reason is that potentially RMInit::bmOut may be destructed before the RMTimer destructor is called possibly causing a crash.
|
inline |
constructor, initializes members and starts timer.
|
inline |
destructor, calls stop().
The parameters newClass and newFunc have to be string literals. Just a pointer to them is stored. No output is generated if RManBenchmark < newBmLevel.
|
inline |
|
inline |
pauses timer.
If newOutoutput is FALSE no output is created on RMInit::bmOut on the following calls to stop() and ~RMTimer() until the next start().
|
inline |
resumes timer.
|
inline |
switch output on RMInit::bmOut on and off.
|
inline |
resets timer.
|
inline |
prints time spent if output is TRUE.
Also switches output to RMInit::bmOut on again.