This class implements a high precision clock.
More...
#include <CPrecisionClock.h>
|
| | cPrecisionClock () |
| | Constructor of cPrecisionClock.
|
| |
| virtual | ~cPrecisionClock () |
| | Destructor of cPrecisionClock.
|
| |
| void | reset (const double a_currentTime=0.0) |
| | This method resets the clock.
|
| |
| double | start (bool a_resetClock=false) |
| | This method starts the clock with optional reset.
|
| |
| double | stop () |
| | This method stops the clock and return the elapsed time.
|
| |
| bool | on () const |
| | This method returns true if the clock is running (ON), otherwise false if the clock is paused (OFF).
|
| |
| double | getCurrentTimeSeconds () const |
| | This method returns the current clock time in seconds.
|
| |
| void | setTimeoutPeriodSeconds (const double a_timeoutPeriod) |
| | This method sets the period in seconds before a timeout occurs (you need to poll for this).
|
| |
| double | getTimeoutPeriodSeconds () const |
| | This method reads the programmed timeout period is seconds.
|
| |
| bool | timeoutOccurred () const |
| | This method returns true if timeout has occurred, otherwise return false.
|
| |
| bool | highResolution () const |
| | This method returns true if the high resolution CPU clock is available on this computer, false. otherwise.
|
| |
|
| static LARGE_INTEGER | m_freq |
| | Stores information about CPU high precision clock.
|
| |
| static bool | m_highres = false |
| | If true, then high precision CPU clock is available.
|
| |
| static bool | m_initialized = false |
| | If true, then static members of cPrecisionClock have been initialized.
|
| |
cPrecisionClock implements a high-precision clock. All measurements are computed in seconds unless otherwise-specified.
cPrecisionClock behaves just like a real chronograph: It can be started, stopped and restarted at a later time. When a clock is running (ON), time is accumulated until the next stop event (OFF). The value of a clock can be read by calling method getCurrentTimeSeconds(). When a clock is disabled (OFF), time is no longer accumulated.
◆ cPrecisionClock()
| chai3d::cPrecisionClock::cPrecisionClock |
( |
| ) |
|
◆ ~cPrecisionClock()
| virtual chai3d::cPrecisionClock::~cPrecisionClock |
( |
| ) |
|
|
inlinevirtual |
◆ reset()
| void chai3d::cPrecisionClock::reset |
( |
const double |
a_currentTime = 0.0 | ) |
|
This method resets clock with an initial time value in seconds. (Default value is 0 seconds).
- Parameters
-
| a_currentTime | Time in seconds to initialize clock. |
◆ start()
| double chai3d::cPrecisionClock::start |
( |
bool |
a_resetClock = false | ) |
|
This method starts or restarts the clock. To read the clock time, call method getCurrentTimeSeconds().
- Parameters
-
| a_resetClock | If true clock is initialized, otherwise resume counting. |
- Returns
- Current clock time in seconds.
◆ stop()
| double chai3d::cPrecisionClock::stop |
( |
| ) |
|
This method stops the clock and returns elapsed time. To resume counting call method start().
- Returns
- Time in seconds.
◆ on()
| bool chai3d::cPrecisionClock::on |
( |
| ) |
const |
|
inline |
◆ getCurrentTimeSeconds()
| double chai3d::cPrecisionClock::getCurrentTimeSeconds |
( |
| ) |
const |
This method returns the current time of clock in seconds.
- Returns
- Current time in seconds.
◆ setTimeoutPeriodSeconds()
| void chai3d::cPrecisionClock::setTimeoutPeriodSeconds |
( |
const double |
a_timeoutPeriod | ) |
|
This method sets the period in seconds before timeout occurs. Do not forget to enable the timer ON by calling method start(). Monitoring for timeout is performed by calling timeoutOccurred().
- Parameters
-
| a_timeoutPeriod | Timeout period in seconds. |
◆ getTimeoutPeriodSeconds()
| double chai3d::cPrecisionClock::getTimeoutPeriodSeconds |
( |
| ) |
const |
|
inline |
◆ timeoutOccurred()
| bool chai3d::cPrecisionClock::timeoutOccurred |
( |
| ) |
const |
This method check if the clock has expired its timeout period.
- Returns
- true if timeout occurred, otherwise false.
◆ highResolution()
| bool chai3d::cPrecisionClock::highResolution |
( |
| ) |
const |
|
inline |
◆ getCPUTimeSeconds()
| double chai3d::cPrecisionClock::getCPUTimeSeconds |
( |
| ) |
|
|
static |
This method returns the raw CPU time in seconds.
- Returns
- Raw CPU clock time in seconds.
◆ initialize()
| void chai3d::cPrecisionClock::initialize |
( |
| ) |
|
|
staticprotected |
◆ m_freq
| LARGE_INTEGER chai3d::cPrecisionClock::m_freq |
|
staticprotected |
◆ m_highres
| bool chai3d::cPrecisionClock::m_highres = false |
|
staticprotected |
◆ m_initialized
| bool chai3d::cPrecisionClock::m_initialized = false |
|
staticprotected |
◆ m_timeAccumulated
| double chai3d::cPrecisionClock::m_timeAccumulated |
|
protected |
◆ m_timeStart
| double chai3d::cPrecisionClock::m_timeStart |
|
protected |
◆ m_timeoutPeriod
| double chai3d::cPrecisionClock::m_timeoutPeriod |
|
protected |
◆ m_timeoutStart
| double chai3d::cPrecisionClock::m_timeoutStart |
|
protected |
◆ m_on
| bool chai3d::cPrecisionClock::m_on |
|
protected |
The documentation for this class was generated from the following files: