└>Geo::GeoSingleton< GeoFrameTime >
This class measures frame rate and also computes a running average of the last n frames.
It's designed as a singleton.
Name | Description |
---|---|
tClass * m_Singleton = NULL | Pointer to the singleton instance or NULL if not started. |
const float ms_DefaultFramerate | The framerate to return when there has not yet been enough samples. |
const Geo::s32 ms_NumAverageFrames = 300 | The number of frames to average over. |
Name | Description |
---|---|
~GeoFrameTime() | Destructor. |
~GeoSingleton() | Destructor clears singleton pointer. |
GeoFrameTime() | Constructor just sets up defaults. |
GeoSingleton() | Constructor initialises singleton pointer. |
Get() | Returns a pointer to the singleton instance. |
GetAbsoluteTime() | Returns number of seconds since the beginning. |
GetAverageFramesPerSecond() | Returns average of frame rate over a number of frames. |
GetAverageFrameTime() | Returns frame time averaged over a number of frames. |
GetConstFramerate() | Get the constant frame rate. |
GetFrameNumber() | Returns number of update calls made. |
GetFramesPerSecond() | Returns current frame rate. |
GetFrameTime() | Returns length of last frame in seconds. |
GetMaximumFrameTime() | Returns the maximum frame time over the same averaged period as GetAverageFrameTime() |
IsAvailable() | Returns true if the singleton is available. |
IsPaused() | Return true if we are paused. |
IsRunningConstFramerate() | Find out if we're running with a constant frame rate. |
NonCopyable(NonCopyable &&) | Defaulted to allow move. |
operator=(NonCopyable &&) | Defaulted to allow move. |
Pause(bool) | Pause the timer, handles nested pause calls but they are to be avoided. |
SetConstFramerate(bool, float) | Enable/disable constant frame rate mode and set rate. |
Start() | Setup the singleton instance. |
Stop() | Release the singleton instance. |
Update() | Update the frame time - increments frame number and calculates frame time as elapsed time since last call. |
public: ~GeoFrameTime()
Destructor.
protected: ~GeoSingleton()
Destructor clears singleton pointer.
public: GeoFrameTime()
Constructor just sets up defaults.
protected: GeoSingleton()
Constructor initialises singleton pointer.
public: tClass * Get()
Returns a pointer to the singleton instance.
public: double GetAbsoluteTime() const
Returns number of seconds since the beginning.
public: float GetAverageFramesPerSecond() const
Returns average of frame rate over a number of frames.
public: float GetAverageFrameTime() const
Returns frame time averaged over a number of frames.
public: float GetConstFramerate() const
Get the constant frame rate.
public: Geo::u32 GetFrameNumber() const
Returns number of update calls made.
public: float GetFramesPerSecond() const
Returns current frame rate.
public: float GetFrameTime() const
Returns length of last frame in seconds.
public: float GetMaximumFrameTime() const
Returns the maximum frame time over the same averaged period as GetAverageFrameTime()
public: bool IsAvailable()
Returns true if the singleton is available.
public: bool IsPaused() const
Return true if we are paused.
public: bool IsRunningConstFramerate() const
Find out if we're running with a constant frame rate.
public: NonCopyable
(
NonCopyable &&
)
Defaulted to allow move.
public: NonCopyable & operator=
(
NonCopyable &&
)
Defaulted to allow move.
public: Geo::s32 Pause
(
bool pause
)
Pause the timer, handles nested pause calls but they are to be avoided.
public: void SetConstFramerate
(
bool enable,
float rate
)
Enable/disable constant frame rate mode and set rate.
public: bool Start()
Setup the singleton instance.
public: void Stop()
Release the singleton instance.
public: void Update()
Update the frame time - increments frame number and calculates frame time as elapsed time since last call.
It is assumed that this function is called at the beginning of every frame, so when it is called the first time the frame time is unknown, so it will return FrameNumber == 0, FrameTime == 1/ms_DefaultFramerate, Framerate = ms_DefaultFramerate and AbsoluteTime == 0.