debian,kali,ubuntu限制cpu最大使用率

kali修改cpu最大使用率

1.下载工具
apt install cpufreqd -y
2.修改/etc/cpufreqd.conf

文件内容如下没有文件就新建文件

# this is a comment
# see CPUFREQD.CONF(5) manpage for a complete reference
#
# Note: ondemand/conservative Profiles are disabled because
#       they are not available on many platforms.
​
[General]
pidfile=/var/run/cpufreqd.pid
poll_interval=2
verbosity=4
#enable_remote=1
#remote_group=root
[/General]
​
[Profile]
name=Powersave Low
minfreq=35%
maxfreq=80%
policy=powersave
[/Profile]
​
[Rule]
name=AC Rule
ac=on                    # (on/off)
profile=Powersave Low
[/Rule]
 
# stay in performance mode for the first minutes
[Rule]
name=AC Off - High Power
ac=off                   # (on/off)
battery_interval=70-100
#exec_post=echo 5 > /proc/acpi/sony/brightness
profile=Powersave Low
[/Rule]
​
# conservative mode when not AC
[Rule]
name=AC Off - Medium Battery
ac=off                   # (on/off)
battery_interval=30-70
#exec_post=echo 3 > /proc/acpi/sony/brightness
profile=Powersave Low
[/Rule]
​
# conservative mode when not AC
[Rule]
name=AC Off - Low Battery
ac=off                   # (on/off)
battery_interval=0-30
#exec_post=echo 3 > /proc/acpi/sony/brightness
profile=Powersave Low
[/Rule]
​
##
# Special Rules
##
# CPU Too hot!
[Rule]
name=CPU Too Hot
acpi_temperature=55-100
cpu_interval=50-100
profile=Powersave Low
[/Rule]
​
# use performance mode if I'm watching a movie
# I don't care for batteries! 
# But don't heat too much.
[Rule]
name=Movie Watcher
programs=xine,mplayer,gmplayer
battery_interval=0-100
acpi_temperature=0-60
cpu_interval=0-100
profile=Powersave Low
[/Rule]
​
3.修改最大使用率
默认为80%使用下面语句把75%改成你想限制的最大值,或直接修改/etc/cpufreqd.conf内的maxfreq的值
sed -i 's/maxfreq=80%/maxfreq=75%/g' /etc/cpufreqd.conf
4.查看cpu最大使用率
cat /etc/cpufreqd.conf | grep maxfreq
5.激活配置文件重启
 cpufreqd -f /etc/cpufreqd.conf