rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
Public Member Functions | List of all members
RMTimer Class Reference

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.
 
 ~RMTimer ()
 The parameters newClass and newFunc have to be string literals.
 
void setOutput (int newOutput)
 switch output on RMInit::bmOut on and off.
 
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().
 
void resume ()
 resumes timer.
 
void start ()
 resets timer.
 
void stop ()
 Also switches output to RMInit::bmOut on again.
 
int getTime ()
 Time spent is the time since construction or last start() excluding the times between pause() and resume().
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RMTimer()

RMTimer::RMTimer ( const char *  newClass,
const char *  newFunc,
int  newBmLevel = 4 
)

constructor, initializes members and starts timer.

◆ ~RMTimer()

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().

Member Function Documentation

◆ getTime()

int RMTimer::getTime ( )

Time spent is the time since construction or last start() excluding the times between pause() and resume().

delivers current time count.

◆ pause()

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.

◆ resume()

void RMTimer::resume ( )

resumes timer.

◆ setOutput()

void RMTimer::setOutput ( int  newOutput)

switch output on RMInit::bmOut on and off.

◆ start()

void RMTimer::start ( )

resets timer.

◆ stop()

void RMTimer::stop ( )

Also switches output to RMInit::bmOut on again.

prints time spent if output is TRUE.


The documentation for this class was generated from the following file: