High-Performance Counter Support (Windows CE 5.0)
There are two built-in high-performance counter routines, QueryPerformanceCounter and QueryPerformanceFrequency. QueryPerformanceCounter returns a 64-bit number representing timer counts and QueryPerformanceFrequency returns the number of high-performance ticks per second. It is used to convert counts to a time value.
In many cases, 64-bit high-resolution counters are not implemented in hardware platforms. A workaround is to implement the counter using 32-bit hardware counters and implement the rollover to 64-bits through an interrupt.
Another is to use the thread scheduling timer to update a 64-bit tick count. Like PerfCountSinceTick, this works well if the underlying hardware timer has a large number of ticks per millisecond. Otherwise, OEMQueryPerformanceCounter does not offer much of an advantage over GetTickCount.
If the thread timer tick will meet your needs, you can use the boilerplate implementations of QueryPerformanceCounter and QueryPerformanceFrequency provided with the sample OAL.
The sample routines are implemented in terms of PerfCountSinceTick and PerfCountFreq, which are also used in interrupt latency timing.
Send Feedback on this topic to the authors