Isle
Loading...
Searching...
No Matches
MxStopWatch Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MxStopWatch()

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.

◆ ~MxStopWatch()

MxStopWatch::~MxStopWatch ( )
inline

Destructor.

[AI]

Definition at line 36 of file mxstopwatch.h.

Member Function Documentation

◆ ElapsedSeconds()

double MxStopWatch::ElapsedSeconds ( ) const

Returns the total accumulated elapsed time in seconds.

[AI]

◆ Reset()

void MxStopWatch::Reset ( )

Resets the stopwatch to zero.

[AI]

[AI] Clears the start tick and accumulated elapsed time.

◆ Start()

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.

◆ Stop()

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.

◆ TicksPerSeconds()

unsigned long MxStopWatch::TicksPerSeconds ( ) const
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.


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