class Geo::GeoFrameTime
└>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.
Variables
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. |
Functions
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. |
Anchor | ||||
---|---|---|---|---|
|
Geo::GeoFrameTime::~GeoFrameTime
...
public: ~GeoFrameTime()
...
Destructor.
Anchor | ||||
---|---|---|---|---|
|
Geo::GeoSingleton< tClass >::~GeoSingleton
...
protected: ~GeoSingleton()
...
Destructor clears singleton pointer.
Anchor | ||||
---|---|---|---|---|
|
Geo::GeoFrameTime::GeoFrameTime
...
public: GeoFrameTime()
...
Constructor just sets up defaults.
Anchor | ||||
---|---|---|---|---|
|
Geo::GeoSingleton< tClass >::GeoSingleton
...
protected: GeoSingleton()
...
Constructor initialises singleton pointer.
Anchor | ||||
---|---|---|---|---|
|
tClass * Geo::GeoSingleton< tClass >::Get
...
public: tClass * Get()
...
Returns a pointer to the singleton instance.
Anchor | ||||
---|---|---|---|---|
|
double Geo::GeoFrameTime::GetAbsoluteTime
...
public: double GetAbsoluteTime() const
...
Returns number of seconds since the beginning.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetAverageFramesPerSecond
...
public: float GetAverageFramesPerSecond() const
...
Returns average of frame rate over a number of frames.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetAverageFrameTime
...
public: float GetAverageFrameTime() const
...
Returns frame time averaged over a number of frames.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetConstFramerate
...
public: float GetConstFramerate() const
...
Get the constant frame rate.
Anchor | ||||
---|---|---|---|---|
|
Geo::u32 Geo::GeoFrameTime::GetFrameNumber
...
public: Geo::u32 GetFrameNumber() const
...
Returns number of update calls made.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetFramesPerSecond
...
public: float GetFramesPerSecond() const
...
Returns current frame rate.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetFrameTime
...
public: float GetFrameTime() const
...
Returns length of last frame in seconds.
Anchor | ||||
---|---|---|---|---|
|
float Geo::GeoFrameTime::GetMaximumFrameTime
...
public: float GetMaximumFrameTime() const
...
Returns the maximum frame time over the same averaged period as GetAverageFrameTime()
Anchor | ||||
---|---|---|---|---|
|
bool Geo::GeoSingleton< tClass >::IsAvailable
...
public: bool IsAvailable()
...
Returns true if the singleton is available.
Anchor | ||||
---|---|---|---|---|
|
bool Geo::GeoFrameTime::IsPaused
...
public: bool IsPaused() const
...
Return true if we are paused.
Anchor | ||||
---|---|---|---|---|
|
bool Geo::GeoFrameTime::IsRunningConstFramerate
...
public: bool IsRunningConstFramerate() const
...
Find out if we're running with a constant frame rate.
Anchor | ||||
---|---|---|---|---|
|
Geo::NonCopyable::NonCopyable
...
public: NonCopyable
(
NonCopyable &&
)
...
Defaulted to allow move.
Anchor | ||||
---|---|---|---|---|
|
NonCopyable& Geo::NonCopyable::operator=
...
public: NonCopyable & operator=
(
NonCopyable &&
)
...
Defaulted to allow move.
Anchor | ||||
---|---|---|---|---|
|
Geo::s32 Geo::GeoFrameTime::Pause
...
public: Geo::s32 Pause
(
bool pause
)
...
Pause the timer, handles nested pause calls but they are to be avoided.
Anchor | ||||
---|---|---|---|---|
|
void Geo::GeoFrameTime::SetConstFramerate
...
public: void SetConstFramerate
(
bool enable,
float rate
)
...
Enable/disable constant frame rate mode and set rate.
Anchor | ||||
---|---|---|---|---|
|
bool Geo::GeoSingleton< tClass >::Start
...
public: bool Start()
...
Setup the singleton instance.
Anchor | ||||
---|---|---|---|---|
|
void Geo::GeoSingleton< tClass >::Stop
...
public: void Stop()
...
Release the singleton instance.
Anchor | ||||
---|---|---|---|---|
|
void Geo::GeoFrameTime::Update
...
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.