Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

NameDescription
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

NameDescription
~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
adfb48111444ac7cd01fbb516147495f1
adfb48111444ac7cd01fbb516147495f1

Geo::GeoFrameTime::~GeoFrameTime

...

public: ~GeoFrameTime()

...

Destructor.


Anchor
a82ee7edacbf148ad1a6036575dc756a2
a82ee7edacbf148ad1a6036575dc756a2

Geo::GeoSingleton< tClass >::~GeoSingleton

...

protected: ~GeoSingleton()

...

Destructor clears singleton pointer.


Anchor
aeefc0dcf232c030b36036aee690f8159
aeefc0dcf232c030b36036aee690f8159

Geo::GeoFrameTime::GeoFrameTime

...

public: GeoFrameTime()

...

Constructor just sets up defaults.


Anchor
a6336f7cf559d808beac7f44144741ce6
a6336f7cf559d808beac7f44144741ce6

Geo::GeoSingleton< tClass >::GeoSingleton

...

protected: GeoSingleton()

...

Constructor initialises singleton pointer.


Anchor
aabdf9e4e0dd8c2c8e1f1dc3ebe532f11
aabdf9e4e0dd8c2c8e1f1dc3ebe532f11

tClass * Geo::GeoSingleton< tClass >::Get

...

public: tClass * Get()

...

Returns a pointer to the singleton instance.


Anchor
ae3ebaa13f0eb4b894f28f7a623bf7c26
ae3ebaa13f0eb4b894f28f7a623bf7c26

double Geo::GeoFrameTime::GetAbsoluteTime

...

public: double GetAbsoluteTime() const

...

Returns number of seconds since the beginning.


Anchor
ab5f1a98c9b5e05703f2b3095093c5618
ab5f1a98c9b5e05703f2b3095093c5618

float Geo::GeoFrameTime::GetAverageFramesPerSecond

...

public: float GetAverageFramesPerSecond() const

...

Returns average of frame rate over a number of frames.


Anchor
a5684e0a9ba954542a6b0c668419b2c1f
a5684e0a9ba954542a6b0c668419b2c1f

float Geo::GeoFrameTime::GetAverageFrameTime

...

public: float GetAverageFrameTime() const

...

Returns frame time averaged over a number of frames.


Anchor
ab643d47d9b8508ff04c51805dc47c3a3
ab643d47d9b8508ff04c51805dc47c3a3

float Geo::GeoFrameTime::GetConstFramerate

...

public: float GetConstFramerate() const

...

Get the constant frame rate.


Anchor
a764f16f115f00816758a6e3bcc73792e
a764f16f115f00816758a6e3bcc73792e

Geo::u32 Geo::GeoFrameTime::GetFrameNumber

...

public: Geo::u32 GetFrameNumber() const

...

Returns number of update calls made.


Anchor
a8912c232b7bd30c013b1fefcfd2fb1a3
a8912c232b7bd30c013b1fefcfd2fb1a3

float Geo::GeoFrameTime::GetFramesPerSecond

...

public: float GetFramesPerSecond() const

...

Returns current frame rate.


Anchor
a87fe6b80c8d6977a9954e03f598dc670
a87fe6b80c8d6977a9954e03f598dc670

float Geo::GeoFrameTime::GetFrameTime

...

public: float GetFrameTime() const

...

Returns length of last frame in seconds.


Anchor
a79d94a27926aad58a4993a5a16b4684e
a79d94a27926aad58a4993a5a16b4684e

float Geo::GeoFrameTime::GetMaximumFrameTime

...

public: float GetMaximumFrameTime() const

...

Returns the maximum frame time over the same averaged period as GetAverageFrameTime()


Anchor
a8544559aa1f9d376753d1aef8baf1de6
a8544559aa1f9d376753d1aef8baf1de6

bool Geo::GeoSingleton< tClass >::IsAvailable

...

public: bool IsAvailable()

...

Returns true if the singleton is available.


Anchor
abd236fcb233b43860f011eb25aede7b5
abd236fcb233b43860f011eb25aede7b5

bool Geo::GeoFrameTime::IsPaused

...

public: bool IsPaused() const

...

Return true if we are paused.


Anchor
ad9e138ca302b43891a0889f4c2a5dcc1
ad9e138ca302b43891a0889f4c2a5dcc1

bool Geo::GeoFrameTime::IsRunningConstFramerate

...

public: bool IsRunningConstFramerate() const

...

Find out if we're running with a constant frame rate.


Anchor
adaed81b4c59f263dcb4e78c4126f4683
adaed81b4c59f263dcb4e78c4126f4683

Geo::NonCopyable::NonCopyable

...

public: NonCopyable
(
    NonCopyable &&
)

...

Defaulted to allow move.


Anchor
a6abc781e23b8f4864e0b868806e0acbf
a6abc781e23b8f4864e0b868806e0acbf

NonCopyable& Geo::NonCopyable::operator=

...

public: NonCopyable & operator=
(
    NonCopyable &&
)

...

Defaulted to allow move.


Anchor
a41c1eafa4668dc244f18b1bf18bdee11
a41c1eafa4668dc244f18b1bf18bdee11

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
a98a4c978fa673f1dc9f17f6cb311300a
a98a4c978fa673f1dc9f17f6cb311300a

void Geo::GeoFrameTime::SetConstFramerate

...

public: void SetConstFramerate
(
    bool enable,
    float rate
)

...

Enable/disable constant frame rate mode and set rate.


Anchor
a16b72c3f5156496b63c45efc7cf6d211
a16b72c3f5156496b63c45efc7cf6d211

bool Geo::GeoSingleton< tClass >::Start

...

public: bool Start()

...

Setup the singleton instance.


Anchor
acfd9a98496840f08a3c50431cb54f805
acfd9a98496840f08a3c50431cb54f805

void Geo::GeoSingleton< tClass >::Stop

...

public: void Stop()

...

Release the singleton instance.


Anchor
abb810a1be0e54966a79e6f2d698b6653
abb810a1be0e54966a79e6f2d698b6653

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.