Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::ScopedTimer Class Reference

A scoped timer class for automatic timing. More...

#include <Timer.h>

Public Member Functions

 ScopedTimer (std::string name, std::optional< float > threshold=std::nullopt)
 Constructs a ScopedTimer with a name and an optional threshold.
 ~ScopedTimer ()
 Destructor for the ScopedTimer.

Static Public Member Functions

static const std::vector< TimerData > & GetTimers ()
 Returns the list of timers.

Detailed Description

A scoped timer class for automatic timing.

This class automatically measures the elapsed time when it goes out of scope. It can also log the elapsed time if it exceeds a specified threshold.

Constructor & Destructor Documentation

◆ ScopedTimer()

Raven::ScopedTimer::ScopedTimer ( std::string name,
std::optional< float > threshold = std::nullopt )
inlineexplicit

Constructs a ScopedTimer with a name and an optional threshold.

Parameters
nameThe name of the timer.
thresholdThe optional threshold for performance measurement.

◆ ~ScopedTimer()

Raven::ScopedTimer::~ScopedTimer ( )
inline

Destructor for the ScopedTimer.

This method logs the elapsed time and checks against the threshold.

Member Function Documentation

◆ GetTimers()

const std::vector< TimerData > & Raven::ScopedTimer::GetTimers ( )
inlinestaticnodiscard

Returns the list of timers.

This method returns a reference to the static vector of TimerData.

Returns
A reference to the vector of TimerData.

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