ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Member Functions | Private Attributes
MyTimer Class Reference

MyTimer can register call(s) and print reports. More...

#include <MyTimer.h>

Collaboration diagram for MyTimer:
Collaboration graph
[legend]

Data Structures

class  OneTimer
 nested class of MyTimer, contains the timers functions More...
 

Public Member Functions

virtual void Report ()
 Make a report for the timers. More...
 
Contructor
 MyTimer ()
 default constructor More...
 
 MyTimer (std::string str_name)
 constructor with a timer name More...
 
virtual ~MyTimer ()
 virtual destructor, class could be derived More...
 
Getter/Setter
std::string GetName ()
 Get the timer name. More...
 
Get times
double GetTotalTime (std::string str_name=std::string())
 Get the total time, anonymous or named. More...
 
double GetAverageTime (std::string str_name=std::string())
 Get the average time, total time / number of calls. More...
 
unsigned int GetNumberCalls (std::string str_name=std::string("default_timer"))
 Get the number of calls (used for average) More...
 
Starting and Stopping the timer
void Start ()
 Start the timer. More...
 
void Stop ()
 Stop the timer. More...
 
void Reset (std::string str_name=std::string("default_timer"))
 Reset the timer. More...
 

Private Attributes

std::string name
 first implementation, only one name, More...
 
OneTimer one_timer
 

Detailed Description

MyTimer can register call(s) and print reports.

Definition at line 24 of file MyTimer.h.

Constructor & Destructor Documentation

MyTimer::MyTimer ( )

default constructor

Definition at line 19 of file MyTimer.cpp.

References one_timer.

MyTimer::MyTimer ( std::string  str_name)

constructor with a timer name

Definition at line 27 of file MyTimer.cpp.

References name, and one_timer.

MyTimer::~MyTimer ( )
virtual

virtual destructor, class could be derived

Definition at line 36 of file MyTimer.cpp.

Member Function Documentation

double MyTimer::GetAverageTime ( std::string  str_name = std::string())

Get the average time, total time / number of calls.

Definition at line 72 of file MyTimer.cpp.

References MyTimer::OneTimer::GetAllTimes(), and one_timer.

Here is the call graph for this function:

std::string MyTimer::GetName ( )
inline

Get the timer name.

Definition at line 40 of file MyTimer.h.

References name.

unsigned int MyTimer::GetNumberCalls ( std::string  str_name = std::string("default_timer"))

Get the number of calls (used for average)

Definition at line 78 of file MyTimer.cpp.

References MyTimer::OneTimer::GetNumberCalls(), and one_timer.

Here is the call graph for this function:

double MyTimer::GetTotalTime ( std::string  str_name = std::string())

Get the total time, anonymous or named.

Definition at line 66 of file MyTimer.cpp.

References MyTimer::OneTimer::GetAllTimes(), and one_timer.

Here is the call graph for this function:

void MyTimer::Report ( )
virtual

Make a report for the timers.

Virtual can be overwriden

Definition at line 84 of file MyTimer.cpp.

References MyTimer::OneTimer::GetAllTimes(), MyTimer::OneTimer::GetNumberCalls(), name, and one_timer.

Here is the call graph for this function:

void MyTimer::Reset ( std::string  str_name = std::string("default_timer"))

Reset the timer.

Postcondition
total time reset to 0
number call reset to 0

Definition at line 58 of file MyTimer.cpp.

References one_timer, and MyTimer::OneTimer::Reset().

Here is the call graph for this function:

void MyTimer::Start ( )

Start the timer.

Definition at line 42 of file MyTimer.cpp.

References one_timer, and MyTimer::OneTimer::Start().

Here is the call graph for this function:

void MyTimer::Stop ( )

Stop the timer.

Increment total time and number calls

Definition at line 50 of file MyTimer.cpp.

References one_timer, and MyTimer::OneTimer::Stop().

Here is the call graph for this function:

Field Documentation

std::string MyTimer::name
private

first implementation, only one name,

default value : "default_timer"

Definition at line 153 of file MyTimer.h.

Referenced by GetName(), MyTimer(), and Report().

OneTimer MyTimer::one_timer
private

Definition at line 158 of file MyTimer.h.

Referenced by GetAverageTime(), GetNumberCalls(), GetTotalTime(), MyTimer(), Report(), Reset(), Start(), and Stop().


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