gpt4 book ai didi

c# - Thread.Sleep 现在使用高分辨率计时器还是 Windows 10 更改了默认系统时钟频率?

转载 作者:行者123 更新时间:2023-12-02 02:32:34 26 4
gpt4 key购买 nike

Thread.Sleep 过去与系统时钟相关,系统时钟的计时间隔约为 16 毫秒,因此任何低于 16 毫秒的时间都会产生 16 毫秒的 sleep 时间。这种行为似乎在某种程度上发生了变化。

发生了什么变化? Thread.Sleep 是否不再与系统时钟相关,而是与高分辨率计时器相关?或者 Windows 10 中的默认系统时钟频率是否有所提高?

编辑:似乎人们有兴趣知道我为什么使用 Thread.Sleep,它实际上超出了问题的范围,问题是为什么行为发生了变化。但无论如何,我注意到我的开源项目 freepie https://andersmalmgren.github.io/FreePIE/ 的变化

它是一个输入/输出模拟器,由最终用户使用 Iron python 控制。它在后台运行。它没有自然中断。所以我需要整理脚本线程,这样它就不会耗尽整个核心。

最佳答案

感谢 Hans Passant 的评论,我第一次错过了它,我发现了问题。事实证明 Nvidia 的驱动程序套件是问题的根源。

Platform Timer Resolution:Outstanding Timer Request A program or service has requested a timer resolution smaller than the platform maximum timer resolution. Requested Period 10000 Requesting Process ID 13396 Requesting Process Path \Device\HarddiskVolume2\Program Files\NVIDIA Corporation\NVIDIA GeForce Experience\NVIDIA Share.exe

这在很多层面上都是非常愚蠢的。从长远来看,这对环境甚至是不利的,因为任何配备 nvidia 的计算机都会消耗更多电量。

编辑:汉斯评论,相关部分:

Too many programs want to mess with it, on top of the list is a free product of a company that sells a mobile operating system. Run powercfg /energy from an elevated command prompt to find the evildoer, "Platform Timer Resolution" in the generated report.

关于c# - Thread.Sleep 现在使用高分辨率计时器还是 Windows 10 更改了默认系统时钟频率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59544369/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com