Isle
|
Measures elapsed wall clock time using high resolution performance counters. More...
#include <mxstopwatch.h>
Public Member Functions | |
MxStopWatch () | |
Default constructor. More... | |
~MxStopWatch () | |
Destructor. More... | |
void | Start () |
Starts (or resumes) timing from the current moment. More... | |
void | Stop () |
Stops timing and accumulates the elapsed interval to m_elapsedSeconds. More... | |
void | Reset () |
Resets the stopwatch to zero. More... | |
double | ElapsedSeconds () const |
Returns the total accumulated elapsed time in seconds. More... | |
Protected Member Functions | |
unsigned long | TicksPerSeconds () const |
Queries and returns the number of performance counter ticks per second. More... | |
Measures elapsed wall clock time using high resolution performance counters.
[AI]
[AI] MxStopWatch uses Windows performance counters (QueryPerformanceCounter) to measure elapsed real-time as precisely as possible. It can be used to profile code execution, update timing, or collect precise time intervals in the game engine.
Definition at line 25 of file mxstopwatch.h.
MxStopWatch::MxStopWatch | ( | ) |
Default constructor.
Initializes the stopwatch and internal state. [AI]
[AI] The stopwatch is reset and the number of ticks per second is queried from the OS. This sets up high-precision timing.
|
inline |
double MxStopWatch::ElapsedSeconds | ( | ) | const |
Returns the total accumulated elapsed time in seconds.
[AI]
void MxStopWatch::Reset | ( | ) |
Resets the stopwatch to zero.
[AI]
[AI] Clears the start tick and accumulated elapsed time.
void MxStopWatch::Start | ( | ) |
Starts (or resumes) timing from the current moment.
[AI]
[AI] Records the current performance counter value. Call Stop() to capture the elapsed time increment.
void MxStopWatch::Stop | ( | ) |
Stops timing and accumulates the elapsed interval to m_elapsedSeconds.
[AI]
[AI] Uses the current and previous start tick to compute the time interval. If the interval cannot be represented by 32 bits, sets to HUGE_VAL_IMMEDIATE.
|
protected |
Queries and returns the number of performance counter ticks per second.
[AI]
[AI] Uses QueryPerformanceFrequency. Returns ULONG_MAX if frequency can't fit in 32 bits.