libcvd
Public Member Functions | List of all members
CVD::SimpleTimer Class Reference

Provides a simple timer class which uses cvd_timer internally. More...

#include <timer.h>

Public Member Functions

 SimpleTimer (const std::string &description, const int &cycles_to_time=1, bool output=true, std::ostream &out=std::cout)
 Create a simple timer object. More...
 
 ~SimpleTimer ()
 Destructor. Deletes the internal cvd_timer.
 
void click ()
 Begin or end a timing cycle. Automatically calls print() when cycles_to_time cycles are reached.
 
void print ()
 Output timing information (average, maximum and minimum times for a set of cycles). More...
 
double get_max ()
 Calculate the max cycle time as double.
 
double get_min ()
 Calculate the min cycle time as double.
 
double get_average ()
 Calculate the average cycle time as double.
 

Detailed Description

Provides a simple timer class which uses cvd_timer internally.

Statistics (average, max and min cycle time) are kept and output for a number of timing cycles. Cycle times are stored in a std::deque<double> and statistics only calculated when the get or print functions are called.

Constructor & Destructor Documentation

◆ SimpleTimer()

CVD::SimpleTimer::SimpleTimer ( const std::string &  description,
const int &  cycles_to_time = 1,
bool  output = true,
std::ostream &  out = std::cout 
)
inline

Create a simple timer object.

Parameters
descriptionA string description of what is being timed (used in output)
cycles_to_timeHow many cycles to time before the times are averaged and output (default 1).
outputWhether or not to output timing information. Default is true.
outstd::ostream to send output information to. Default std::cout.

Member Function Documentation

◆ print()

void CVD::SimpleTimer::print ( )
inline

Output timing information (average, maximum and minimum times for a set of cycles).

Automatically called after cycles_to_time cycles but can be called manually.


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