Public Member Functions | List of all members
ibis::util::timer Class Reference

Print simple timing information. More...

#include <util.h>

Public Member Functions

 timer (const char *msg, int lvl=1)
 Constructor. More...
 
 ~timer ()
 Destructor. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

ibis::util::timer::timer ( const char *  msg,
int  lvl = 1 
)
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.

Note
This class holds a private copy of the message to avoid relying on the incoming message being present at the destruction time.
See also
ibis::horometer

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.


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

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive