Class Timer#
Defined in File time.hpp
Class Documentation#
-
class Timer#
A timer class that can be used to measure a multitude of things. The timer can be started, stopped and reset, and can, optionally, output the time between construction and destruction to the console.
Public Functions
-
inline explicit Timer(std::string name = "")#
Create a new timer with a given name
- Parameters
name – The name of the timer
printOnDestruct – Whether to print the time between construction and destruction
-
inline void start()#
Start the timer.
-
inline void stop()#
Stop the timer.
-
inline void reset()#
Reset the timer.
-
template<int64_t scale = time::second>
inline double elapsed() const# Get the elapsed time in a given unit
- Template Parameters
scale – The unit to return the time in
- Returns
The elapsed time in the given unit
-
template<int64_t scale = time::second>
inline double average() const# Get the average time in a given unit
- Template Parameters
scale – The unit to return the time in
- Returns
The average time in the given unit
-
inline bool isRunning()#
-
inline explicit Timer(std::string name = "")#