Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Timer Class Reference

#include <Timer.h>

Collaboration diagram for Timer:

Collaboration graph
[legend]
List of all members.

Public Methods

 Timer (std::ostream &aOut, const std::string &desc)
void show ()
virtual ~Timer ()
void set_counter (size_t aCount, const std::string &count_desc)

Private Methods

size_t uptime ()
void indent ()

Private Attributes

time_t start
std::string description
std::ostream & out
size_t counter
std::string count_description

Static Private Attributes

int timer_counter = 0

Detailed Description

A simple timer class (just working with seconds)

Definition at line 44 of file Timer.h.


Constructor & Destructor Documentation

Timer std::ostream &    aOut,
const std::string &    desc
[inline]
 

start timer

Timer prints its info when it is destroyed. So all you have to do is declare a timer in an appropriate block.

Parameters:
aOut  where to print timer info
desc  description printed with timer

Definition at line 74 of file Timer.h.

virtual ~Timer   [inline, virtual]
 

Definition at line 102 of file Timer.h.


Member Function Documentation

size_t uptime   [inline, private]
 

Definition at line 53 of file Timer.h.

Referenced by Timer::show().

void indent   [inline, private]
 

Definition at line 59 of file Timer.h.

Referenced by Timer::show(), and Timer::Timer().

void show   [inline]
 

Definition at line 88 of file Timer.h.

Referenced by Timer::~Timer().

void set_counter size_t    aCount,
const std::string &    count_desc
[inline]
 

set a counter for a timer

if you are timing single actions and for example do a loop over 10000 single actions you should set the counter to 10000. If you do the mean time for a single action is calculated.

Parameters:
aCount  number of single actions
count_desc  description of single actions

Definition at line 116 of file Timer.h.


Member Data Documentation

time_t start [private]
 

Definition at line 46 of file Timer.h.

Referenced by Timer::Timer(), and Timer::uptime().

std::string description [private]
 

Definition at line 47 of file Timer.h.

Referenced by Timer::show(), and Timer::Timer().

std::ostream& out [private]
 

Definition at line 48 of file Timer.h.

Referenced by Timer::indent(), Timer::show(), and Timer::Timer().

size_t counter [private]
 

Definition at line 49 of file Timer.h.

Referenced by Timer::set_counter(), Timer::show(), and Timer::Timer().

std::string count_description [private]
 

Definition at line 50 of file Timer.h.

Referenced by Timer::set_counter(), Timer::show(), and Timer::Timer().

int timer_counter = 0 [static, private]
 

Definition at line 24 of file Timer.cpp.

Referenced by Timer::indent(), Timer::Timer(), and Timer::~Timer().


The documentation for this class was generated from the following files:
Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen