Debian下cpupower设置记录
Linux
内核调频知识 链接
查看当前cpu调度器
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
查看cpu支持调度
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
查看当前cpu频率
cat /proc/cpuinfo | grep MHz
(高版本内核可能不适用查看cpu频率)
Debian
下(我用的deepin
):
sudo apt install linux-cpupower
(Debian
下不会有默认配置文件在/etc/default/cpupower
)创建
cpupower
配置文件/etc/default/cpupower
(可以参考其他发行版本下cpupower
的配置文件1
2
3# 自己设置调度
CPUPOWER_START_OPTS="frequency-set -g performance"
CPUPOWER_STOP_OPTS="frequency-set -g powersave"创建
systemd
服务,vim /usr/lib/systemd/system/cpupower.service
1
2
3
4
5
6
7
8
9
10
11
12
13[Unit]
Description=Configure CPU power related settings
After=syslog.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/default/cpupower
ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS
ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
[Install]
WantedBy=multi-user.target- 注意
EnvironmentFile
,其他发行版本换成相应配置文件的路径
- 注意
开启服务
systemctl daemon-reload
systemctl enable cpupower.service
开机自动启动systemctl start cpupower.service
当前启动
- 也不一定要创建服务,写个脚本定时执行
cpupower -c all frequency-set -g 调度类型
就行
cpupower
之类命令记录1
2
3
4cpupower -c all frequency-info #查看所有cpu info
cpupower -c all frequency-set -g xxx #修改所有cpu调度类型
cat /proc/cpuinfo | grep MHz #查看当前cpu频率
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!