class RED::Timer
Timer class. More...
#include <REDTimer.h>
Inherits: Object.
Public functions:
Timer ( ) | |
virtual | ~Timer ( ) |
virtual void * | As ( const RED::CID & iCID ) |
virtual const void * | As ( const RED::CID & iCID ) const |
template< class T_As > const T_As * | As ( ) const |
template< class T_As > T_As * | As ( ) |
bool | IsStarted ( ) const |
float | MSElapsed ( ) const |
float | SecondsElapsed ( ) const |
RED_RC | Start ( ) |
Public static functions:
static RED::CID | GetClassID ( ) |
Protected variables:
__int64 | _freq |
__int64 | _start |
Detailed description:
Timer class.
Use RED::Timer::Start to initialize a measure. Use RED::Timer::MSElapsed to get the elapsed time since the last call to Start in milliseconds (or RED::Timer::SecondsElapsed in seconds). Note that there's no threading management in this class.
It's possible that the timer fails to initialize on certain CPUs (on windows platforms: Those that do not support high resolution performance counters). If this case occurs, any call to RED::Timer::Start will return a RED_INIT_FAILED, and measurement methods are all to return negative invalid values.
Functions documentation
public RED::Timer::Timer | ( | ) |
Timer construction method.
This constructor calibrates the timer.
public virtual RED::Timer::~Timer | ( | ) |
Timer destruction method.
public static RED::CID RED::Timer::GetClassID | ( | ) |
Reimplements: RED::Object::GetClassID.
public virtual void * RED::Timer::As | ( | const RED::CID & | iCID | ) |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
public virtual const void * RED::Timer::As | ( | const RED::CID & | iCID | ) const |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
template< class T_As > public const T_As * RED::Timer::As | ( | ) const |
Template version of the as const method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
template< class T_As > public T_As * RED::Timer::As | ( | ) |
Template version of the as method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
public bool RED::Timer::IsStarted | ( | ) const |
Do we have started a time record?
Returns:
public float RED::Timer::MSElapsed | ( | ) const |
Gives time elapsed since last RED::Timer::Start call, in milliseconds.
This method returns the time elapsed since last call to RED::Timer::Start, in milliseconds. If Start has not ever been called before, the method returns 0.0f.
Returns:
public float RED::Timer::SecondsElapsed | ( | ) const |
Gives time elapsed since last RED::Timer::Start call, in seconds.
This method returns the time elapsed since last call to RED::Timer::Start, in seconds. If Start has not ever been called before, the method returns 0.0f.
Returns:
public RED_RC RED::Timer::Start | ( | ) |
Measures time starting now.
Sets the timer's time reference to the moment of the call.
Returns:
RED_OK when the operation succeeded,
RED_FAIL in case of an unexpected failure.
Variables documentation
High performance counters per second. Calculated at instance allocation time only.
Time recorded during the last call to RED::Timer::Start.