ubuntu如何把调整cpu策略

一、安装cpu频率管理软件

sudo apt-get install cpufrequtils
二、查看cpu当前状态
cpufreq-info
feng@Heimerdinger:/sys/devices/system/cpu/cpu2/cpufreq$ cpufreq-info 
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
analyzing CPU 1:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
analyzing CPU 2:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
analyzing CPU 3:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
其中available cpufreq governors:performance,powersave表示我的cpu目前只支持高性能和省电两个模式

所有的策略模式包括powersave, userspace, ondemand, conservative, performance这几种

三、设置cpu策略(在此我设置的策略是performance)

sudo cpufreq-set -g performance
此刻cpu的频率就有所改变了,在查看cpu信息
feng@Heimerdinger:/sys/devices/system/cpu/cpu2/cpufreq$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 2.20 GHz.
analyzing CPU 1:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 2.20 GHz.
analyzing CPU 2:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 2.20 GHz.
analyzing CPU 3:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 0.97 ms.
  hardware limits: 500 MHz - 2.70 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 500 MHz and 2.70 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 2.20 GHz.
四、设置当下策略下cpu频率
sudo cpufreq-set -d 1800m -u 2700m      //适用模式:powersave|ondemand|conservative|performance

sudo cpufreq-set -f {1800m~2700m}       //适用模式:userspace


 -d 设置最小频率

 -u 设置最大频率






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值