|
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. More... | |
FPSCounter (int nDelayFrames=10) | |
Constructs a new FPS counter. More... | |
float | getFPS () |
Get frames per second. More... | |
float | getMaxCycleTimeMS () |
Get maximum cycle time since start. More... | |
float | getMeanCycleTimeMS () |
Get mean cycle time over last 10 frames. More... | |
float | getMinCycleTimeMS () |
Get minimum cycle time since start. More... | |
int | getUpdates () |
Get number of updates. More... | |
bool | getValid () |
Get if calculated values are valid. More... | |
void | recalculate () |
recalculates the FPS statistics More... | |
void | reset () |
Resets the FPS counter to its initial state. More... | |
void | update () |
Updates the FPS counter. More... | |
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic tasks.
Further synchronization to a given FPS is supported.
Definition at line 36 of file FPSCounter.h.
FPSCounter | ( | int | nDelayFrames = 10 | ) |
Constructs a new FPS counter.
nDelayFrames | number of frames to use for FPS calculation. The FPS calculation will be delayed by this amount of frames |
Definition at line 38 of file FPSCounter.cpp.
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.
fFrameRate | frames per second to use for synchronization |
Definition at line 82 of file FPSCounter.cpp.
float getFPS | ( | ) |
Get frames per second.
Definition at line 127 of file FPSCounter.cpp.
float getMaxCycleTimeMS | ( | ) |
Get maximum cycle time since start.
Definition at line 164 of file FPSCounter.cpp.
float getMeanCycleTimeMS | ( | ) |
Get mean cycle time over last 10 frames.
Definition at line 137 of file FPSCounter.cpp.
float getMinCycleTimeMS | ( | ) |
Get minimum cycle time since start.
Definition at line 154 of file FPSCounter.cpp.
int getUpdates | ( | ) |
Get number of updates.
Definition at line 122 of file FPSCounter.cpp.
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)
Definition at line 117 of file FPSCounter.cpp.
void recalculate | ( | ) |
recalculates the FPS statistics
Definition at line 72 of file FPSCounter.cpp.
void reset | ( | ) |
Resets the FPS counter to its initial state.
Definition at line 49 of file FPSCounter.cpp.
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.
Definition at line 60 of file FPSCounter.cpp.