Statistics
Static utility class for tracking performance metrics such as FPS, timers, and frame details. More...
#include "Utils/Statistics.h"
Public Classes
Name | |
---|---|
class | Frame <br>Nested class for frame-specific statistics. |
class | GPU <br>Nested class for GPU-specific statistics. |
Public Functions
Name | |
---|---|
Statistics() =delete<br>Deleted constructor to prevent instantiation. | |
~Statistics() =delete<br>Deleted destructor to prevent destruction. | |
void | startGPUTimer(const std::string & name)<br>Starts a GPU timer for the given name. |
void | startTimer(const std::string & name)<br>Starts a timer with the given name. |
void | stopGPUTimer(const std::string & name)<br>Stops a GPU timer for the given name. |
void | stopTimer(const std::string & name)<br>Stops a timer with the given name. |
void | update()<br>Updates the internal state of the statistics system. |
Public Attributes
Name | |
---|---|
std::map< std::string, TimerPtr > | CPUTimers <br>Map of all active timers. |
float | DeltaTime <br>Time elapsed between frames, in seconds. |
float | FPS <br>Current frames per second. |
std::map< std::string, TimerPtr > | GPUTimers |
Detailed Description
class Statistics;
class Statistics;
Static utility class for tracking performance metrics such as FPS, timers, and frame details.
The [Statistics](/cpp-api-reference/classes/classStatistics)
class provides static members and methods to track and manage application performance metrics. It includes nested classes for frame-specific and GPU-specific statistics.
Public Functions Documentation
function Statistics
Statistics() =delete
Statistics() =delete
Deleted constructor to prevent instantiation.
function ~Statistics
~Statistics() =delete
~Statistics() =delete
Deleted destructor to prevent destruction.
function startGPUTimer
static void startGPUTimer(
const std::string & name
)
static void startGPUTimer(
const std::string & name
)
Starts a GPU timer for the given name.
Parameters:
- name The name of the timer to start.
If a timer with the specified name does not exist, it is created and started.
function startTimer
static void startTimer(
const std::string & name
)
static void startTimer(
const std::string & name
)
Starts a timer with the given name.
Parameters:
- name The name of the timer to start.
- name The name of the timer to start.
Starts a CPU timer for the given name.
If a timer with the specified name does not exist, it is created and started.
function stopGPUTimer
static void stopGPUTimer(
const std::string & name
)
static void stopGPUTimer(
const std::string & name
)
Stops a GPU timer for the given name.
Parameters:
- name The name of the timer to stop.
If a timer with the specified name exists, it is stopped.
function stopTimer
static void stopTimer(
const std::string & name
)
static void stopTimer(
const std::string & name
)
Stops a timer with the given name.
Parameters:
- name The name of the timer to stop.
- name The name of the timer to stop.
Stops a CPU timer for the given name.
If a timer with the specified name exists, it is stopped.
function update
static void update()
static void update()
Updates the internal state of the statistics system.
Updates statistics including frame ID, FPS, and GPU memory usage.
This function increments the frame ID and updates FPS and DeltaTime values using ImGui's IO metrics. Additionally, it checks for GPU memory info support and retrieves memory usage details if the necessary OpenGL extension is available.
Public Attributes Documentation
variable CPUTimers
static std::map< std::string, TimerPtr > CPUTimers = {};
static std::map< std::string, TimerPtr > CPUTimers = {};
Map of all active timers.
Each timer is identified by a string name.
variable DeltaTime
static float DeltaTime = 0.0f;
static float DeltaTime = 0.0f;
Time elapsed between frames, in seconds.
variable FPS
static float FPS = 0.0f;
static float FPS = 0.0f;
Current frames per second.
variable GPUTimers
static std::map< std::string, TimerPtr > GPUTimers = {};
static std::map< std::string, TimerPtr > GPUTimers = {};
Updated on 2025-05-31 at 12:55:30 +0000