cPrecisionClock Class Reference

cPrecisionClock provides a class to manage high precision time measurments. Units are micro seconds. More...

#include <CPrecisionClock.h>

List of all members.

Public Member Functions

 cPrecisionClock ()
 Constructor of cPrecisionClock.
 ~cPrecisionClock ()
 Destructor of cPrecisionClock.
void initialize ()
 reset clock to zero.
long start ()
 start counting from current time of clock.
long stop ()
 stop clock counting.
bool on ()
 return true if timer is currently on, else return false.
void setCurrentTime (long a_currentTime)
 set current time of clock. Units are microseconds.
long getCurrentTime ()
 read current time of clock. Units are microseconds.
void setTimeoutPeriod (long a_timeoutPeriod)
 set the period in microseconds before timeout occurs.
long getTimeoutPeriod ()
 Read the programmed timeout period.
bool timeoutOccurred ()
 return true if timeout has occurred.
bool highResolution ()
 return true if high resolution timers are available on this computer.
double getCPUtime ()
 If all you want is something that tells you the time, this is your function...

Private Member Functions

long getCount ()
 Read CPU clock in microseconds.

Private Attributes

LARGE_INTEGER m_freq
 Stores information about CPU high precision clock.
long m_timeCurrent
 Current time of clock.
long m_timeStart
 CPU time when clock was started.
long m_timeoutPeriod
 Timeout period.
long m_timeoutStart
 CPU time when timer was started.
bool m_highres
 If true, then high precision CPU clock is available.
bool m_on
 If true, clock is on.


Detailed Description

cPrecisionClock provides a class to manage high precision time measurments. Units are micro seconds.


Constructor & Destructor Documentation

cPrecisionClock::cPrecisionClock (  ) 

Constructor of cPrecisionClock.

Constructor of cPrecisionClock. Clock is initialized to zero.

cPrecisionClock::~cPrecisionClock (  ) 

Destructor of cPrecisionClock.

Destructor of cPrecisionClock.


Member Function Documentation

void cPrecisionClock::initialize (  ) 

reset clock to zero.

Initialize the clock. Current time is set to zero.

long cPrecisionClock::start (  ) 

start counting from current time of clock.

Start the clock from its current time value. To read the latest time from the clock, use getCurrentTime().

Returns:
Return time of clock when timer was started.

long cPrecisionClock::stop (  ) 

stop clock counting.

Stop the timer. To resume counting call start().

Returns:
Return time in microseconds.

long cPrecisionClock::getCurrentTime (  ) 

read current time of clock. Units are microseconds.

Set the current time of timer. Result is returned in microseconds.

void cPrecisionClock::setTimeoutPeriod ( long  a_timeoutPeriod  ) 

set the period in microseconds before timeout occurs.

Set the period in microseconds before timeout occurs. Do not forget to set the timer on by calling start()

Parameters:
a_timeoutPeriod Timeout period in microseconds.

bool cPrecisionClock::timeoutOccurred (  ) 

return true if timeout has occurred.

Check if timer has expired its timeout period. if so return true.

Returns:
Return true if timeout occurred, otherwise false.

double cPrecisionClock::getCPUtime (  ) 

If all you want is something that tells you the time, this is your function...

If all you want is something that tells you the time, this is your function...

Returns:
Return cpu clock in seconds.

long cPrecisionClock::getCount (  )  [private]

Read CPU clock in microseconds.

Read the high resolution clock of the computer

Returns:
Return cpu clock in microseconds.


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 09:41:48 2007 for CHAI 3D by  doxygen 1.5.2