Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

sword::Chronograph Class Reference


Public Methods

 Chronograph ()
 Creates a Chronograph.

void clear ()
 Clear (reset) the Chronograph.

void start ()
 Start measuring time.

void stop ()
 Stop measuring time.

word32 elapsedTimeInMillis ()
 Get the accumulated time in milliseconds.

double elapsedTimeInSec ()
 Get the accumulated time in seconds.


Detailed Description

A Chronograph for measuring time spent in code. Each instance of this class accumulates time spent by your program between calls to start() and stop(). The time can then be retrieved by elapsedTimeXXX() methods.

Example:

    Chronograph c;
    c.start();
    for(int i=0; i<10000; ++i) { / * do stuff * / }
    c.stop();
    cout << "Spent = " << c.elapsedTimeInSec() << " seconds" << endl;
  


Constructor & Destructor Documentation

sword::Chronograph::Chronograph  
 

Creates a Chronograph.

The time measurement is not started yet. You must call start() once to start the chronograph.


Member Function Documentation

void sword::Chronograph::clear  
 

Clear (reset) the Chronograph.

The accumulated elapsed time is lost, and you have to call start() again to start measuring again

word32 sword::Chronograph::elapsedTimeInMillis  
 

Get the accumulated time in milliseconds.

This method can be called either 'during measurement' (between a start() and a stop() ), or 'post morten' (after a stop() ).

See also:
elapsedTimeInSec, start, stop

double sword::Chronograph::elapsedTimeInSec  
 

Get the accumulated time in seconds.

void sword::Chronograph::start  
 

Start measuring time.

See also:
start, elapsedTimeInMillis, elapsedTimeInSec

void sword::Chronograph::stop  
 

Stop measuring time.

The time elapsed between the last call to start() and this call is accumulated in the chronograph

See also:
start, elapsedTimeInMillis, elapsedTimeInSec


Generated on Tue Dec 23 20:08:56 2003 for SWORD by doxygen1.3-rc2