如何将“性能”而不是“节能”设置为默认值?

Wit*_*tek 15 cpufreq 17.04

当我启动我的 Unity 桌面时,CPU 指示器只显示一个条形,它被设置为Powersave。当我切换到性能时,我必须输入管理员用户密码。

但是在系统重新启动后,我的 CPU 又回到了Powersave。如何将性能设置为默认值,以便每次重新启动后都不必切换它?

Win*_*nix 27

性能和节电调控器策略

Ask Ubuntu 和其他网站中描述了用于设置 CPU 调控器策略的各种选项:

请记住,大多数网站建议将 CPU 管理保留在Powersave. 我在笔记本电脑上,发现使用英特尔的 ThermalD 和 P-State 技术以及 TLP 电源管理在频率、风扇速度和温度方面效果最佳。

总结以上链接

要从上述答案中总结实现您的目标,请使用:

安装 cpufrequutils:

sudo apt-get install cpufrequtils
Run Code Online (Sandbox Code Playgroud)

然后编辑以下文件(如果它不存在,则创建它):

sudo nano /etc/default/cpufrequtils
Run Code Online (Sandbox Code Playgroud)

并向其添加以下行:

GOVERNOR="performance"
Run Code Online (Sandbox Code Playgroud)

保存并退出。

要使更改生效,请运行:

sudo systemctl restart cpufrequtils
Run Code Online (Sandbox Code Playgroud)

然后您可以运行cpufreq-info以查看有关您的 CPU 频率、调控器等的信息:

$ cpufreq-info
    current policy: frequency should be within 800 MHz and 3.90 GHz.
              The governor "performance" may decide which speed to use
              within this range.
Run Code Online (Sandbox Code Playgroud)

根据此问答:在 18.04 中将 CPU 调节器设置为性能

如果您一直想要性能调节器,则需要/etc/rc.local在包含以下内容的最后一行之前编辑和插入这些行exit 0

sleep 120 # Give CPU startup routines time to settle.
cpupower frequency-set --governor performance
Run Code Online (Sandbox Code Playgroud)

/etc/rc.local在 18.04 中进行设置,请参阅:如何/etc/rc.local使用 Systemd启用

  • 这也适用于 Ubuntu 18.04 和 18.10,以防万一有人想知道...... (3认同)

小智 6

我无法发表评论,因为我的声誉很低,但我想添加已接受的答案。您还需要运行

sudo /etc/init.d/cpufrequtils restart
Run Code Online (Sandbox Code Playgroud)

使其在您的系统上生效。然后您应该看到您的频率在列出的最大值附近徘徊,并且

current policy: frequency should be within 800 MHz and 3.90 GHz.
              The governor "performance" may decide which speed to use
              within this range.
Run Code Online (Sandbox Code Playgroud)

当你输入 cpufreq-info

  • 感谢那。我已经根据您的建议提交了对已接受答案的编辑; (3认同)