Advertisement

QueryPerformanceCounter & hardware

Started by February 28, 2000 08:05 PM
1 comment, last by NewDeal 24 years, 6 months ago
Heyz i was looking through the "Microsoft''s guide to win95 programming" and i fell over the function QueryPerformanceCounter(). It says that the hardware needs to support "high-resolution performance counting" for the func to work. What hardware supports this and is it standard ? I need a timer accurate enough to control the pace of my game. is this what im looking for ? if not - what should i use ? Thanx
My understanding of how QueryPerformanceCounter is implemented:

It uses an undocumented Pentium instruction that gives you the number of cycles since processor startup. Given that and the processor frequency (how they figure that out i dunno, i assume the BIOS knows cuz it displays it at startup), you can get a VERY accurate timing value.

I''m not 100% positive this is how they do it, only 95%.

But the short of it is: if you are planning on running on anything earlier than a Pentium, than QPC might not work. I''ve never had it not work, though.



-vince


-vince


Advertisement
The "standard" way of doing it in windows is to check if the hardware supports the PC counter at the beginning of the program and fall back to GetTickCount or something if there is no support

This topic is closed to new replies.

Advertisement