![]() |
rasdaman client API
10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
|
Module: raslib. More...
#include <rmdebug.hh>
Public Member Functions | |
| RMTimer (const char *newClass, const char *newFunc, int newBmLevel=4) | |
| constructor, initializes members and starts timer. More... | |
| ~RMTimer () | |
| The parameters newClass and newFunc have to be string literals. More... | |
| void | setOutput (int newOutput) |
| switch output on RMInit::bmOut on and off. More... | |
| void | pause () |
| If newOutoutput is FALSE no output is created on RMInit::bmOut on the following calls to stop() and ~RMTimer() until the next start(). More... | |
| void | resume () |
| resumes timer. More... | |
| void | start () |
| resets timer. More... | |
| void | stop () |
| Also switches output to RMInit::bmOut on again. More... | |
| int | getTime () |
| Time spent is the time since construction or last start() excluding the times between pause() and resume(). 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.
| RMTimer::RMTimer | ( | const char * | newClass, |
| const char * | newFunc, | ||
| int | newBmLevel = 4 |
||
| ) |
constructor, initializes members and starts timer.
| RMTimer::~RMTimer | ( | ) |
The parameters newClass and newFunc have to be string literals.
Just a pointer to them is stored. No output is generated if RManBenchmark < newBmLevel. destructor, calls stop().
| int RMTimer::getTime | ( | ) |
| void RMTimer::pause | ( | ) |
If newOutoutput is FALSE no output is created on RMInit::bmOut on the following calls to stop() and ~RMTimer() until the next start().
pauses timer.
| void RMTimer::resume | ( | ) |
resumes timer.
| void RMTimer::setOutput | ( | int | newOutput | ) |
switch output on RMInit::bmOut on and off.
| void RMTimer::start | ( | ) |
resets timer.
| void RMTimer::stop | ( | ) |
Also switches output to RMInit::bmOut on again.
prints time spent if output is TRUE.
1.8.17