High performance counter

Started by
12 comments, last by johndunne 21 years, 6 months ago
cheers guys, thats helped loads! In addition, i''ve checked out the high performance counter on a 133Mhz Pentium (overclocked to 150 though) and it reports 1193180 iterations per second too! Ouch, i''m utterly confused!
I'm all dunne now
Advertisement
what''s the PIT clock? That seems to be the one popping up on the pentium systems..
daerid@gmail.com
PIT == 8254 timer
Basically it''s a 16 bit counter running at 1.193 MHz (wacky freq = original PC system clock / 12, so IBM saved a crystal. Thanks, guys)
It can be made to emit a regular interrupt (freq = input freq / divisor); div == 64k yields the infamous 18.2 Hz tick rate.
What QPC does is just read the counter.
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3
The frequency of the performance counter isn''t what matters. When doing calculations with it, you need to do all calculations in relation to QueryPerformanceFrequency. This allows you to base all your calculations per millisecond or per second. Anything below a (lets say..) 100''th of a millisecond is pretty much useless as you cannot query the performance counter fast enough anyways.

As for the Calculations, you can just use the 64bit values on pretty much any pentium system. Although they are 32 bit, they can add/sub/etc a 64 bit value atomically. Typically you''ll be using the performance counter values to calculate deltas, in which case you can typically cast them into 32 bit values without any loss of data.

This topic is closed to new replies.

Advertisement