#include <CPrecisionClock.h>
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. |
cPrecisionClock::cPrecisionClock | ( | ) |
Constructor of cPrecisionClock.
Constructor of cPrecisionClock. Clock is initialized to zero.
cPrecisionClock::~cPrecisionClock | ( | ) |
Destructor of cPrecisionClock.
Destructor of cPrecisionClock.
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().
long cPrecisionClock::stop | ( | ) |
stop clock counting.
Stop the timer. To resume counting call start().
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()
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.
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...
long cPrecisionClock::getCount | ( | ) | [private] |
Read CPU clock in microseconds.
Read the high resolution clock of the computer