Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QueryPerformanceCounter Status?

I've read some about the problems and inaccuracy of the QPC implementation. But all those discussions and articles seem rather out of date.

Anyone know what the current status is of the QPC functionality on the latest Win7 OS and Intel/AMD cpus? Has there been any improvements? Is e.g. Turbo Boost still a big issue?

I'm mainly interested in this since I need to decide between using timeGetTime and QueryPerformanceCounter for timing in my application.

like image 436
ronag Avatar asked Sep 02 '11 18:09

ronag


1 Answers

QPC was patched software side by microsoft ages ago (old kb article on the problem: http://support.microsoft.com/kb/895980 ). This fix can be installed on any target system for piece of mind (I've seen a few games doing this), however it shouldn't be needed. All newer processors have a hardware fix/compensation for this, as well as having the TSC correctly synced between cores, so the problems with RDTSC based timers are eliminated. The hot-fix can be gotten from here: http://support.microsoft.com/?id=896256 i'm not sure if there is anything for other systems, but from the looks of it this fix was inheirent in windows vista and windows 7 based OSes. As for the question of accuracy, that depends on the hardware itself, however Microsoft says QPC is the most reliably accurate timer you can get (with decent performance), so short of inline __rdtsc(), I doubt you'll get any more accurate.

like image 104
Necrolis Avatar answered Sep 26 '22 03:09

Necrolis