动态电压和频率缩放 API
Linux 上是否存在 API(C 语言)来允许进程动态更改其运行的内核的电压或频率?
Does an API (in C) exist on Linux to allow a process to dynamically change the voltage or the frequency of the core it runs on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能有这样的库,但即使没有,您也可以随时打开 /sys/devices/system/cpu 下配置 CPU 行为的文件。
查看 /sys/devices/system/cpu/cpuX/cpufreq 下的文件。
There might be such a library, but even if it doesn't, you can always open the files under /sys/devices/system/cpu that configure the behavior of the CPU.
Take a look to the files under /sys/devices/system/cpu/cpuX/cpufreq .
您可以通过写入以下内容来更改频率电压对:
/sys/devices/system/cpu/cpu%d/cpufreq/scaling_setspeed 文件。每个硬件线程都有一个文件。但是,您只能更改整个芯片(所有内核)的频率。您可以从以下位置找到可用频率:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
如果您没有此文件夹,请检查您的处理器是否具有可用的增强型 Intel SpeedStep® 技术。如果有,请进入 BIOS 并启用它,您将看到该文件夹。
另一件事,您可能需要启用/安装 cpufreq 模块。
希望它对某人有所帮助,因为原来的位置已经很旧了。
You can change the frequency voltage pair by writing to:
/sys/devices/system/cpu/cpu%d/cpufreq/scaling_setspeed file. There is a file for each hardware thread. However, you can only change the frequency for the entire chip (all the cores). You can find the available frequencies from:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
If you do not have this folder, check if your processor has Enhanced Intel SpeedStep® Technology available. If it has, go to the BIOS and enable it and you will see the folder.
One more thing, you might need to enable/install the cpufreq module.
Hope it helps someone since the original position is old.
CPU 动态电压频率调节示例:
CPU Dynamic Voltage-Frequency Scaling Example: