Isle
Loading...
Searching...
No Matches
mxstopwatch.h
Go to the documentation of this file.
1#ifndef _MxStopWatch_h
2#define _MxStopWatch_h
3
4#include "assert.h"
5
6#include <limits.h> // ULONG_MAX
7#include <math.h>
8#include <windows.h>
9
11//
12// MxStopWatch
13//
14// NOTE: MxStopWatch measures elapsed (wall clock) time.
15//
16
17#define HUGE_VAL_IMMEDIATE 1.7976931348623157e+308
18
19// SIZE 0x18
26public:
32
37
42 void Start();
43
48 void Stop();
49
54 void Reset();
55
59 double ElapsedSeconds() const;
60
61protected:
66 unsigned long TicksPerSeconds() const;
67
68private:
69 LARGE_INTEGER m_startTick;
70 // ??? when we provide LARGE_INTEGER arithmetic, use a
71 // LARGE_INTEGER m_elapsedTicks rather than m_elapsedSeconds
72
73 double m_elapsedSeconds;
74 unsigned long m_ticksPerSeconds;
75};
76
77// SYNTHETIC: LEGO1 0x100a6fc0
78// SYNTHETIC: BETA10 0x100d8e70
79// MxStopWatch::~MxStopWatch
80
82//
83// MxFrequencyMeter
84//
85
86// SIZE 0x20
92public:
97
103
109
114 double Frequency() const;
115
119 void Reset();
120
124 unsigned long OperationCount() const;
125
129 double ElapsedSeconds() const;
130
135 void IncreaseOperationCount(unsigned long delta);
136
137private:
138 unsigned long m_operationCount;
139 MxStopWatch m_stopWatch;
140};
141
142// SYNTHETIC: LEGO1 0x100abd10
143// SYNTHETIC: BETA10 0x1017de40
144// MxFrequencyMeter::~MxFrequencyMeter
145
146#endif /* _MxStopWatch_h */
Utility for measuring the frequency (operations per second) of a repeated operation.
Definition: mxstopwatch.h:91
MxFrequencyMeter()
Constructs a new MxFrequencyMeter with zeroed counters.
void IncreaseOperationCount(unsigned long delta)
Increases the operation count by the specified delta.
void EndOperation()
Marks the end of a measured operation and increments the count.
void Reset()
Resets the operation counter and stopwatch to zero.
void StartOperation()
Marks the beginning of a measured operation.
double ElapsedSeconds() const
Returns the total elapsed seconds since the last Reset().
unsigned long OperationCount() const
Returns the total number of completed operations.
double Frequency() const
Returns the measured frequency (operations per elapsed second).
Measures elapsed wall clock time using high resolution performance counters.
Definition: mxstopwatch.h:25
unsigned long TicksPerSeconds() const
Queries and returns the number of performance counter ticks per second.
void Stop()
Stops timing and accumulates the elapsed interval to m_elapsedSeconds.
void Reset()
Resets the stopwatch to zero.
double ElapsedSeconds() const
Returns the total accumulated elapsed time in seconds.
~MxStopWatch()
Destructor.
Definition: mxstopwatch.h:36
MxStopWatch()
Default constructor.
void Start()
Starts (or resumes) timing from the current moment.