QueryPerformanceCounter Status?

随声附和 提交于 2019-11-30 05:47:51

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/7287663/queryperformancecounter-status

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!