All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions
TimeReport Class Reference

Detailed Description

Same as Timer but prints a report on destruction. This example shows its usage.

* void myAlg(ListGraph &g,int n)
* {
* TimeReport tr("Running time of myAlg: ");
* ... //Here comes the algorithm
* }
*
See Also
Timer
NoTimeReport

#include <lemon/time_measure.h>

+ Inheritance diagram for TimeReport:

Public Member Functions

 TimeReport (std::string title, std::ostream &os=std::cerr, bool run=true, bool active=true)
 Constructor. More...
 
 ~TimeReport ()
 Destructor that prints the ellapsed time.
 
bool active () const
 Retrieve the activity status. More...
 
void active (bool a)
 Set the activity status. More...
 
- Public Member Functions inherited from Timer
 Timer (bool run=true)
 Constructor. More...
 
void reset ()
 Reset and stop the time counters. More...
 
void start ()
 Start the time counters. More...
 
void stop ()
 Stop the time counters. More...
 
void halt ()
 Halt (i.e stop immediately) the time counters. More...
 
int running ()
 Returns the running state of the timer. More...
 
void restart ()
 Restart the time counters. More...
 
double userTime () const
 Gives back the ellapsed user time of the process.
 
double systemTime () const
 Gives back the ellapsed system time of the process.
 
double cUserTime () const
 Gives back the ellapsed user time of the process' children. More...
 
double cSystemTime () const
 Gives back the ellapsed user time of the process' children. More...
 
double realTime () const
 Gives back the ellapsed real time.
 
 operator TimeStamp () const
 Computes the ellapsed time. More...
 

Constructor & Destructor Documentation

TimeReport ( std::string  title,
std::ostream &  os = std::cerr,
bool  run = true,
bool  active = true 
)
inline

Constructor.

Parameters
titleThis text will be printed before the ellapsed time.
osThe stream to print the report to.
runSets whether the timer should start immediately.
activeSets whether the report should actually be printed on destruction.

Member Function Documentation

bool active ( ) const
inline

void active ( bool  a)
inline

This function set whether the time report should actually be printed on destruction.