如何禁用动态频率缩放? [英] How to Disable Dynamic Frequency Scaling?

查看:364
本文介绍了如何禁用动态频率缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一些微基准测试,并尽量做到正确。不幸的是,动态频率缩放使得基准测试非常不可靠。



有没有一种方法可以通过编程方式(C ++,Windows)如果,这可以在程序中禁用?



Ive试图在实际的基准测试之前使用一个使用100%CPU的热身阶段,但这个

更新:即使我在BIOS中禁用SpeedStep,cpu-z也显示频率在1995 and 2826 GHz

解决方案

一般来说,您需要执行以下步骤:




  • 调用 CallNtPowerInformation()并传递 SystemPowerCapabilities InformationLevel 参数,将 lpInputBuffer nInputBufferSize 设置为 NULL ,然后将 lpOutputBuffer < href =http://msdn.microsoft.com/en-us/library/aa373215(v=VS.85).aspx> SYSTEM_POWER_CAPABILITIES 结构,并将 nOutputBufferSize 设置为尺寸的结构。在第一次调用之后,包含当前系统电源功能的 SYSTEM_POWER_CAPABILITIES 结构。要检查系统是否支持处理器限制,请读取 ProcessorThrottle 的值。


  • 还有我们感兴趣的其他两个成员,他们是:ProcessorMinThrottle 它们表示支持的系统处理器调节的最小和最大级别,以百分比表示。


  • 要禁用CPU限制,请单击确定。如果两个成员都已经值100%,则表示CPU限制目前已停用,因此您无需重新配置。您需要将 ProcessorMinThrottle ProcessorMaxThrottle 设置为 100%。为此,请再次调用 CallNtPowerInformation()并将 SystemPowerCapabilities 传递到 InformationLevel 参数;但现在将 lpInputBuffer 设置为SYSTEM_POWER_CAPABILITIES结构,其中两个成员已设置为 100%




在非程序化方式下,您还可以获取/设置Windows 使用Windows内置命令行工具,即 PowerCfg



进一步阅读




I would like to do some microbenchmarks, and try to do them right. Unfortunately dynamic frequency scaling makes benchmarking highly unreliable.

Is there a way to programmatically (C++, Windows) find out if dynamic frequency scaling is enabled? If, can this be disabled in a program?

Ive tried to just use a warmup phase that uses 100% CPU for a second before the actual benchmark takes place, but this turned out to be not reliable either.

UPDATE: Even when I disable SpeedStep in the BIOS, cpu-z shows that the frequency changes between 1995 and 2826 GHz

解决方案

In general, you need to do the following steps:

  • Call CallNtPowerInformation() and pass SystemPowerCapabilities to InformationLevel parameter, set lpInputBuffer and nInputBufferSize to NULL, then set lpOutputBuffer to SYSTEM_POWER_CAPABILITIES structure, and set nOutputBufferSize to the size of the structure. After this first call, SYSTEM_POWER_CAPABILITIES structure containing the current system power capabilities. To check whether the system supports processor throttling, read the value of ProcessorThrottle.

  • There are other two members we are interested in, they are, ProcessorMinThrottle and ProcessorMaxThrottle; they represents the minimum and maximum level of system processor throttling supported, expressed as a percentage. If both members has already values 100%, this means CPU throttling is currently disabled, so you don't need to reconfigure it.

  • To disable CPU throttling, you need to set ProcessorMinThrottle and ProcessorMaxThrottle to 100%. To do this, call CallNtPowerInformation() again and pass SystemPowerCapabilities to InformationLevel parameter; but now, set lpInputBuffer to the SYSTEM_POWER_CAPABILITIES structure in which the two members has been set to 100%. I'm sure you know what to do next.

In non-programmatic way, you can also get/set Windows Power Options using the Windows built-in command-line tools, that is, PowerCfg.

Further Reading

这篇关于如何禁用动态频率缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆