All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Files | Functions
Time Measuring and Counting
Miscellaneous Tools

Detailed Description

This group contains simple tools for measuring the performance of algorithms.

Classes

class  Counter
 A counter class. More...
 
class  NoCounter
 'Do nothing' version of Counter. More...
 
class  TimeStamp
 A class to store (cpu)time instances. More...
 
class  Timer
 Class for measuring the cpu time and real time usage of the process. More...
 
class  TimeReport
 Same as Timer but prints a report on destruction. More...
 
class  NoTimeReport
 'Do nothing' version of TimeReport More...
 

Files

file  counter.h
 Tools for counting steps and events.
 
file  time_measure.h
 Tools for measuring cpu usage.
 

Functions

template<class F >
TimeStamp runningTimeTest (F f, double min_time=10, unsigned int *num=NULL, TimeStamp *full_time=NULL)
 Tool to measure the running time more exactly.
 
std::ostream & operator<< (std::ostream &os, const TimeStamp &t)
 Prints the time counters.
 

Function Documentation

TimeStamp lemon::runningTimeTest ( f,
double  min_time = 10,
unsigned int *  num = NULL,
TimeStamp *  full_time = NULL 
)

This function calls f several times and returns the average running time. The number of the executions will be choosen in such a way that the full real running time will be roughly between min_time and 2*min_time.

Parameters
fthe function object to be measured.
min_timethe minimum total running time.
Return values
numif it is not NULL, then the actual number of execution of f will be written into *num.
full_timeif it is not NULL, then the actual total running time will be written into *full_time.
Returns
The average running time of f.
std::ostream & operator<< ( std::ostream &  os,
const TimeStamp t 
)
related

Prints the time counters in the following form:

u: XX.XXs s: XX.XXs cu: XX.XXs cs: XX.XXs real: XX.XXs

where the values are the

  • u: user cpu time,
  • s: system cpu time,
  • cu: user cpu time of children,
  • cs: system cpu time of children,
  • real: real time.
Note
On WIN32 platform the cummulative values are not calculated.