Class CpuTimer
Defined in File misc.h
Class Documentation
-
class CpuTimer
Tracks elapsed CPU time of the calling thread.
On platforms without a precise per-thread CPU clock, such as Windows, this uses std::clock instead, which tracks the CPU time of the whole process, or on Windows, the wall time (see CpuTimer::uses_thread_clock).
Public Functions
-
inline CpuTimer()
Constructor.
-
inline void reset()
Reset the timer.
-
inline double elapsed_seconds() const
Get elapsed CPU time in seconds since initialization or last reset.
- Returns:
CPU time in seconds
-
inline double elapsed_milliseconds() const
Get elapsed CPU time in milliseconds since initialization or last reset.
- Returns:
CPU time in milliseconds
Public Static Attributes
-
static bool const uses_thread_clock
Whether the timer uses a thread clock (i.e. provides proper, thread-specific CPU time).
-
inline CpuTimer()