All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Private Attributes | List of all members
blaze::timing::Timer< TP > Class Template Reference

Progress timer for time and performance measurements.The Timer class offers timing & benchmarking functionality for all kinds of applications. The following example code demonstrates the use of the WcTimer class, which combines the Timer class template with the WcPolicy for wall clock time measurements, for a single time measurement: More...

#include <Timer.h>

Public Types

typedef TP TimingPolicy
 Timing policy of the Timer.
 

Public Member Functions

Constructor
 Timer ()
 Constructor of the Timer class. More...
 
Timing functions
void start ()
 Starting a single time measurement. More...
 
void end ()
 Ending a single time measurement. More...
 
void reset ()
 Resetting the timer. More...
 
Get functions
size_t getCounter () const
 Returns the total number of time measurements performed by this timer. More...
 
Time evaluation functions
double total () const
 Returns the total elapsed time of all performed time measurements. More...
 
double average () const
 Returns the average time of all performed time measurements. More...
 
double min () const
 Returns the minimal time of all performed time measurements. More...
 
double max () const
 Returns the maximal time of all performed time measurements. More...
 
double last () const
 Returns the last measured time. More...
 

Private Attributes

size_t counter_
 Number of performed time measurements.
 
double start_
 Start of the current time measurement.
 
double end_
 End of the current time measurement.
 
double time_
 The total elapsed time of all measurements.
 
double min_
 The minimal time of all measurements.
 
double max_
 The maximal time of all measurements.
 
double last_
 The last measured time.
 

Detailed Description

template<typename TP>
class blaze::timing::Timer< TP >

Progress timer for time and performance measurements.

The Timer class offers timing & benchmarking functionality for all kinds of applications. The following example code demonstrates the use of the WcTimer class, which combines the Timer class template with the WcPolicy for wall clock time measurements, for a single time measurement:

// Creating a new wall clock timer immediately starts a new time measurement
WcTimer timer;
... // Programm or code fragment to be measured
// Stopping the time measurement
timer.end();
// Evaluation of the measured time
double time = timer.last();

The timer class additionally offers the functionality to start several time measurments in order to evaluate minimal, maximal or average times. The next example demonstrates a possible setup for such a series of time measurements:

// Creating a new wall clock timer
WcTimer timer;
... // Additional setup code
// Starting 10 wall clock time measurements
for( unsigned int i=0; i<10; ++i ) {
timer.start();
... // Programm or code fragment to be measured
timer.end();
}
// After the measurements, the desired timing results can be calculated, as for instance the
// average wall clock time
double average = timer.average();

Constructor & Destructor Documentation

template<typename TP >
blaze::timing::Timer< TP >::Timer ( )
inlineexplicit

Constructor of the Timer class.

The creation of a new timer immediately starts a new time measurement. It is possible to either restart the time measurement at a specific point of time or to continue the time measurement and to end it via the end() function.

Member Function Documentation

template<typename TP >
double blaze::timing::Timer< TP >::average ( ) const
inline

Returns the average time of all performed time measurements.

Returns
The average time.
template<typename TP >
void blaze::timing::Timer< TP >::end ( )
inline

Ending a single time measurement.

Returns
void

This function ends the currently running time measurement and performs the necessary statistical calculations.

template<typename TP >
size_t blaze::timing::Timer< TP >::getCounter ( ) const
inline

Returns the total number of time measurements performed by this timer.

Returns
The number of performed time measurements.
template<typename TP >
double blaze::timing::Timer< TP >::last ( ) const
inline

Returns the last measured time.

Returns
The last measured time.
template<typename TP >
double blaze::timing::Timer< TP >::max ( ) const
inline

Returns the maximal time of all performed time measurements.

Returns
The maximal time.
template<typename TP >
double blaze::timing::Timer< TP >::min ( ) const
inline

Returns the minimal time of all performed time measurements.

Returns
The minimal time.
template<typename TP >
void blaze::timing::Timer< TP >::reset ( )
inline

Resetting the timer.

Returns
void

This function completely resets the timer and all information on the performed time measurements. In order to start a new time measurement, the start() function has to be used.

template<typename TP >
void blaze::timing::Timer< TP >::start ( )
inline

Starting a single time measurement.

Returns
void

This function starts a single time measurement.

template<typename TP >
double blaze::timing::Timer< TP >::total ( ) const
inline

Returns the total elapsed time of all performed time measurements.

Returns
The total elapsed time of all time measurements.

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