为了读取Turbo Boost的当前状态,我们需要安装msr工具
sudo apt-get install msr-tools
要知道Turbo Boost功能是否被禁用,请运行:
rdmsr -pi 0x1a0 -f 38:38
1=disabled
0=enabled
将i替换为你的内核编号
注意:如果出现以下错误:
rdmsr:open: No such file or directory
然后使用以下命令加载"msr"模块:
sudo modprobe msr
要禁用Turbo Boost特性,可以将整个0x1a0 MSR寄存器设置为0x4000850089,如下所示:
wrmsr -pC 0x1a0 0x4000850089
C指的是特定的核心数
通过运行
cat /proc/cpuinfo | grep processor
一旦你知道了你的数字,就必须对每个核心运行上面的命令,
wrmsr -p0 0x1a0 0x4000850089
wrmsr -p1 0x1a0 0x4000850089
从http://notepad2.blogspot.com/2014/11/a-script-to-turn-off-intel-cpu-turbo.html
禁用/启用turbo的脚本
以下脚本可用于关闭/打开turbo:
#!/bin/bash
if [[ -z $(which rdmsr) ]]; then
echo"msr-tools is not installed. Run 'sudo apt-get install msr-tools' to install it." >&2
exit 1
fi
if [[ ! -z $1 && $1 !="enable" && $1 !="disable" ]]; then
echo"Invalid argument: $1" >&2
echo""
echo"Usage: $(basename $0) [disable|enable]"
exit 1
fi
cores=$(cat /proc/cpuinfo | grep processor | awk '{print $3}')
for core in $cores; do
if [[ $1 =="disable" ]]; then
sudo wrmsr -p${core} 0x1a0 0x4000850089
fi
if [[ $1 =="enable" ]]; then
sudo wrmsr -p${core} 0x1a0 0x850089
fi
state=$(sudo rdmsr -p${core} 0x1a0 -f 38:38)
if [[ $state -eq 1 ]]; then
echo"core ${core}: disabled"
else
echo"core ${core}: enabled"
fi
done
将此保存到名为turbo-boost.sh
的文件
用法:你可以复制上面的脚本并将其保存到名为turbo-boost的文件,然后将其设置为可执行:
sudo chmod +x turbo-boost.sh
然后可以使用它禁用/启用turbo:
./turbo-boost.sh disable
./turbo-boost.sh enable
答案2
如果你的系统正在使用intel_pstate频率缩放驱动程序:
$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
然后你可以查询turbo enabled或disabled状态:
$ cat /sys/devices/system/cpu/intel_pstate/no_turbo
0
其中0表示启用turbo,1表示禁用,你可以把(作为sudo )写到同一个位置。
$ echo"1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
1
$ cat set_cpu_turbo_off
#! /bin/bash
echo"1" > /sys/devices/system/cpu/intel_pstate/no_turbo
$ cat set_cpu_turbo_on
#! /bin/bash
echo"0" > /sys/devices/system/cpu/intel_pstate/no_turbo
相关文章