Naughter Software Logo

CPerformanceCounter v1.02 A C++ class which encapsulates the Windows performance counters API

CPerformanceCounter is a freeware C++ class which encapsulates the performance counters API of Windows. The performance counter API on Windows is composed of the SDK calls "QueryPerformanceFrequency" and "QueryPerformanceCounter". These two methods provide a high frequency counter value (normally with a single digit Megahertz frequency), which is synchronized across CPU cores. This is the official way to implement high performance timers on Windows. Other approaches such as the Pentium assembly language instruction of "RDTSC" are available (wrapped by the CCPUTicker class of the author) but the frequency of this counter can change as the frequency of a CPU is changed based on technologies such as Intel SpeedStep. Also on modern CPUs different cores can be slowed down individually meaning that the value you get back can become inconsistent if your code is migrated from core to core as it runs. This simple class avoids these issues while still providing a simple and high speed API.

 

Copyright

 

Updates

V1.02 (2 January 2016)

V1.01 (5 April 2015)

v1.0 (30 March 2010)