CVD::SimpleTimer Class Reference
[General C++ and system helper functions]

#include <timer.h>

List of all members.

Public Member Functions

void click ()
 Begin or end a timing cycle. Automatically calls print() when cycles_to_time cycles are reached.
double get_average ()
 Calculate the average cycle time as double.
double get_max ()
 Calculate the max cycle time as double.
double get_min ()
 Calculate the min cycle time as double.
void print ()
 SimpleTimer (const std::string &description, const int &cycles_to_time=1, bool output=true, std::ostream &out=std::cout)
 ~SimpleTimer ()
 Destructor. Deletes the internal cvd_timer.

Private Attributes

double average
double cumulative_time
double increment
cvd_timerinternal_cvd_timer
double max
double min
bool output_info
int period
std::ostream & sout
std::string text
double time_at_start_of_timing
std::deque< double > time_buffer
bool timing_started
int timings

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.

Definition at line 89 of file timer.h.


Constructor & Destructor Documentation

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:
description A string description of what is being timed (used in output)
cycles_to_time How many cycles to time before the times are averaged and output (default 1).
output Whether or not to output timing information. Default is true.
out std::ostream to send output information to. Default std::cout.

Definition at line 97 of file timer.h.

CVD::SimpleTimer::~SimpleTimer (  )  [inline]

Destructor. Deletes the internal cvd_timer.

Definition at line 104 of file timer.h.


Member Function Documentation

void CVD::SimpleTimer::click (  )  [inline]

Begin or end a timing cycle. Automatically calls print() when cycles_to_time cycles are reached.

Definition at line 110 of file timer.h.

double CVD::SimpleTimer::get_average (  )  [inline]

Calculate the average cycle time as double.

Definition at line 170 of file timer.h.

double CVD::SimpleTimer::get_max (  )  [inline]

Calculate the max cycle time as double.

Definition at line 146 of file timer.h.

double CVD::SimpleTimer::get_min (  )  [inline]

Calculate the min cycle time as double.

Definition at line 159 of file timer.h.

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.

Definition at line 132 of file timer.h.


Member Data Documentation

double CVD::SimpleTimer::average [private]

Definition at line 183 of file timer.h.

Definition at line 188 of file timer.h.

double CVD::SimpleTimer::increment [private]

Definition at line 186 of file timer.h.

Definition at line 191 of file timer.h.

double CVD::SimpleTimer::max [private]

Definition at line 183 of file timer.h.

double CVD::SimpleTimer::min [private]

Definition at line 183 of file timer.h.

Definition at line 182 of file timer.h.

int CVD::SimpleTimer::period [private]

Definition at line 185 of file timer.h.

std::ostream& CVD::SimpleTimer::sout [private]

Definition at line 192 of file timer.h.

std::string CVD::SimpleTimer::text [private]

Definition at line 184 of file timer.h.

Definition at line 189 of file timer.h.

std::deque<double> CVD::SimpleTimer::time_buffer [private]

Definition at line 193 of file timer.h.

Definition at line 190 of file timer.h.

Definition at line 187 of file timer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:52 2013