cpufrequtils命令
## 安装:
yum install cpufrequtils ## 查看CPU信息:
cpufreq-info -m
输出CPU信息为:
analyzing CPU :
driver: acpi-cpufreq
CPUs which run at the same hardware frequency:
CPUs which need to have their frequency coordinated by software:
maximum transition latency: 10.0 us.
hardware limits: 1.20 GHz - 2.60 GHz
available frequency steps: 2.60 GHz, 2.60 GHz, 2.50 GHz, 2.40 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
available cpufreq governors: ondemand, userspace, performance
current policy: frequency should be within 1.20 GHz and 2.60 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1.20 GHz (asserted by call to hardware).
hardware limits显示CPU支持的频率范围
current CPU frequency表示当前的CPU运行频率
available cpufreq governors表示CPU支持的运行模式
当前CPU运行在最低频率下,需要将CPU改为高性能模式。
修改CPU运行模式
## 安装cpuspeed包
yum -y install cpuspeed ## 编辑cpuspeed配置文件
vim /etc/sysconfig/cpuspeed ## 设置GOVERNOR属性
GOVERNOR=performance ## 重启cpuspeed
/etc/init.d/cpuspeed restart
修改后使用“cpufreq-info -m”进行查看:
cpufreq-info -m
cpufrequtils : cpufreq-info (C) Dominik Brodowski -
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU :
driver: acpi-cpufreq
CPUs which run at the same hardware frequency:
CPUs which need to have their frequency coordinated by software:
maximum transition latency: 10.0 us.
hardware limits: 1.20 GHz - 2.60 GHz
available frequency steps: 2.60 GHz, 2.60 GHz, 2.50 GHz, 2.40 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
available cpufreq governors: userspace, performance
current policy: frequency should be within 1.20 GHz and 2.60 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 2.60 GHz (asserted by call to hardware).
发现当前频率为最高频率,修改成功。
常见的性能模式
ondemand:系统默认的超频模式,按需调节,内核提供的功能,不是很强大,但有效实现了动态频率调节,平时以低速方式运行,当系统负载提高时候自动提高频率。以这种模式运行不会因为降频造成性能降低,同时也能节约电能和降低温度。一般官方内核默认的方式都是ondemand。
interactive:交互模式,直接上最高频率,然后看CPU负荷慢慢降低,比较耗电。Interactive 是以 CPU 排程数量而调整频率,从而实现省电。InteractiveX 是以 CPU 负载来调整 CPU 频率,不会过度把频率调低。所以比 Interactive 反应好些,但是省电的效果一般。
conservative:保守模式,类似于ondemand,但调整相对较缓,想省电就用他吧。Google官方内核,kang内核默认模式。
smartass:聪明模式,是I和C模式的升级,该模式在比interactive 模式不差的响应的前提下会做到了更加省电。
performance:性能模式!只有最高频率,从来不考虑消耗的电量,性能没得说,但是耗电量。 powersave 省电模式,通常以最低频率运行。
userspace:用户自定义模式,系统将变频策略的决策权交给了用户态应用程序,并提供了相应的接口供用户态应用程序调节CPU 运行频率使用。也就是长期以来都在用的那个模式。可以通过手动编辑配置文件进行配置 Hotplug:类似于ondemand, 但是cpu会在关屏下尝试关掉一个cpu,并且带有deep sleep,比较省电。