FPSCounter Class Reference

The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic tasks. More...

#include <VisionX/tools/FPSCounter.h>

Public Member Functions

void assureFPS (float fFrameRate)
 Synchronize to FPS.
 
 FPSCounter (int nDelayFrames=10)
 Constructs a new FPS counter.
 
float getFPS ()
 Get frames per second.
 
float getMaxCycleTimeMS ()
 Get maximum cycle time since start.
 
float getMeanCycleTimeMS ()
 Get mean cycle time over last 10 frames.
 
float getMinCycleTimeMS ()
 Get minimum cycle time since start.
 
int getUpdates ()
 Get number of updates.
 
bool getValid ()
 Get if calculated values are valid.
 
void recalculate ()
 recalculates the FPS statistics
 
void reset ()
 Resets the FPS counter to its initial state.
 
void update ()
 Updates the FPS counter.
 

Detailed Description

The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic tasks.

Further synchronization to a given FPS is supported.

Constructor & Destructor Documentation

◆ FPSCounter()

FPSCounter ( int nDelayFrames = 10)

Constructs a new FPS counter.

Parameters
nDelayFramesnumber of frames to use for FPS calculation. The FPS calculation will be delayed by this amount of frames

Member Function Documentation

◆ assureFPS()

void assureFPS ( float fFrameRate)

Synchronize to FPS.

Using this method in a periodic task will synchronize the task to the specified FPS. Update is called internally, so do not call update at a different position.

Parameters
fFrameRateframes per second to use for synchronization

◆ getFPS()

float getFPS ( )

Get frames per second.

Returns
frames per second measure over the last nDelayTime frames (see constructor)

◆ getMaxCycleTimeMS()

float getMaxCycleTimeMS ( )

Get maximum cycle time since start.

Returns
maximum cycle time in ms

◆ getMeanCycleTimeMS()

float getMeanCycleTimeMS ( )

Get mean cycle time over last 10 frames.

Returns
mean cycle time in ms

◆ getMinCycleTimeMS()

float getMinCycleTimeMS ( )

Get minimum cycle time since start.

Returns
minimum cycle time in ms

◆ getUpdates()

int getUpdates ( )

Get number of updates.

Returns
number of updates or assureFPS calls performed since start or last reset

◆ getValid()

bool getValid ( )

Get if calculated values are valid.

Calculated values are valid if the minimum amount of delay frames has passed (m_nDelayFrames, see constructor)

Returns
calculated values valid

◆ recalculate()

void recalculate ( )

recalculates the FPS statistics

◆ reset()

void reset ( )

Resets the FPS counter to its initial state.

◆ update()

void update ( )

Updates the FPS counter.

Using this method in a periodic task will measure the time elapsed from one call to the next. Based on this time, the FPS is calculated.


The documentation for this class was generated from the following files: