6.68 ABA_TIMER Class Reference

class implements a base class for timers measuring the CPU time and the wall-clock time

#include <timer.h>

Inheritance diagram for ABA_TIMER::


PIC


Public Member Functions

Protected Member Functions

Protected Attributes

Private Attributes

Friends

6.68.1 Detailed Description

class implements a base class for timers measuring the CPU time and the wall-clock time

Definition at line 47 of file timer.h.

6.68.2 Constructor & Destructor Documentation

6.68.2.1 ABA_TIMER::ABA_TIMER (ABA_GLOBAL * glob)

The constructor for a timer with a pointer to the global object glob.

After the application of the constructor the timer is not running, i.e., to measure time it has to be started explicitly.

6.68.2.2 ABA_TIMER::ABA_TIMER (ABA_GLOBAL * glob, long centiSeconds)

This constructor initializes the total time of the timer with centiSeconds and the pointer to the corresponding global object glob. The timer is not running, too.

6.68.2.3 virtual ABA_TIMER::~ABA_TIMER () [virtual]

The destructor.

6.68.3 Member Function Documentation

6.68.3.1 void ABA_TIMER::start (bool reset = false)

The timer is started with the function start(). For safety starting a running timer is an error.

Parameters:

reset
If this flag is set to true, the timer is reset before it is started (default=false)}

6.68.3.2 void ABA_TIMER::stop ()

Stops the timer and adds the difference between the current time and the starting time to the total time.

Stopping a non-running timer is an error.

6.68.3.3 void ABA_TIMER::reset ()

Stops the timer and sets the totalTime to 0.

6.68.3.4 bool ABA_TIMER::running () const

Returns:

true If the timer is running,

false otherwise.

6.68.3.5 long ABA_TIMER::centiSeconds () const

Returns:

The currently spent time in 1 _ 100-seconds. It is not necessary to stop the timer to get the correct time.

6.68.3.6 long ABA_TIMER::seconds () const

Returns:

The currently spent time in seconds. It is not necessary to stop the timer to get the correct time. The result is rounded down to the next integer value.

6.68.3.7 long ABA_TIMER::minutes () const

Returns:

The currently spent time in minutes. It is not necessary to stop the timer to get the correct time. The result is rounded down to the next integer value.

6.68.3.8 long ABA_TIMER::hours () const

Returns:

The currently spent time in hours. It is not necessary to stop the timer to get the correct time. The result is rounded down to the next integer value.

6.68.3.9 bool ABA_TIMER::exceeds (const ABA_STRING & maxTime) const

Returns:

true If the currently spent time exceeds maxTime,

false otherwise.

Parameters:

maxTime
A string of the form [[h:]m:]s, where h are the hours, m the minutes, and s the seconds. Hours and minutes are optional. h can be an arbitrary nonnegative integer, s and m have to be integers in {0,,59}. If m or s are less than 10, then a leading 0 is allowed (e.g. 3:05:09).

6.68.3.10 void ABA_TIMER::addCentiSeconds (long centiSeconds)

Parameters:

centiSeconds
The number of centiseconds to be added.

6.68.3.11 virtual long ABA_TIMER::theTime () const [protected, pure virtual]

Is required for measuring the time difference between the time of the call and some base point (e.g., the program start).

We measure time according to the following principle.

The pure virtual function theTime() returns the CPU time since the start of the program for the class CPUABA_TIMER or the elapsed time since some point in the past for the class ABA_COWTIMER. When the timer is started startTime_ is initialized with the a value returned by theTime() and when it is stopped the difference between theTime() and startTime_ is added to the total time.

Implemented in ABA_COWTIMER, and ABA_CPUTIMER.

6.68.4 Friends And Related Function Documentation

6.68.4.1 ostream& operator<< (ostream & out, const ABA_TIMER & rhs) [friend]

The output operator writes the time in the format { hours:minutes:seconds.seconds/100} on an output stream.

After the time has been divided in hours, minutes and seconds we have to take care that an additional leading zero is output if minutes or seconds have a value less than ten.

Returns:

A reference to the output stream.

Parameters:

out
The output stream.
rhs
The timer being output.

6.68.5 Member Data Documentation

6.68.5.1 ABA_GLOBAL*ABA_TIMER::glob_ [protected]

A pointer to the corresponding global object.

Definition at line 176 of file timer.h.

6.68.5.2 long ABA_TIMER::startTime_ [private]

The start time of the timer in 1 _ 100-seconds.

Definition at line 182 of file timer.h.

6.68.5.3 long ABA_TIMER::totalTime_ [private]

The total time in 1 _ 100-seconds.

Definition at line 186 of file timer.h.

6.68.5.4 bool ABA_TIMER::running_ [private]

true, if the timer is running.

Definition at line 190 of file timer.h.

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