查询性能计数器状态?
我读过一些关于 QPC 实现的问题和不准确性的文章。但所有这些讨论和文章似乎都已经过时了。
有人知道最新 Win7 操作系统和 Intel/AMD cpu 上 QPC 功能的当前状态吗?有什么改进吗?例如涡轮增压仍然是一个大问题吗?
我主要对此感兴趣,因为我需要在应用程序中使用 timeGetTime 和 QueryPerformanceCounter 进行计时之间做出决定。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
QPC 很久以前就被微软在软件方面打了补丁(关于这个问题的旧知识库文章:http://support.microsoft. com/kb/895980)。此修复程序可以安装在任何目标系统上(我见过一些游戏这样做),但不需要它。所有较新的处理器都对此进行了硬件修复/补偿,并且使 TSC 在内核之间正确同步,因此消除了基于 RDTSC 的计时器的问题。可以从此处获取修补程序:http://support.microsoft.com/?id=896256 我不确定其他系统是否有任何问题,但从外观上看,这个修复是基于 Windows Vista 和 Windows 7 的操作系统所固有的。至于准确性问题,这取决于硬件本身,但是微软表示 QPC 是您可以获得的最可靠准确的计时器(具有不错的性能),因此缺少内联
__rdtsc()
,我怀疑你会变得更加准确。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.