夏天到了如何为linux降温节能

来源:互联网 发布:访问服务器数据库很慢 编辑:程序博客网 时间:2024/06/11 03:46

夏天到了如何为linux降温节能

--lihn1987(转载请注明出处,谢谢)
   
夏天到了,各位的本本肯定要到了面临崩溃的边缘,而台式机cpu风扇的声音可以与F1赛车的声音有的一拼了。。。。

那么如何为我们的CPU降温呢?我们的做法就是为CPU节能
以下是我的做法:

测试环境
操作系统:ubuntu10.04
CPU       :AMD X4 630 (四核处理器)
首先安装
sudo apt-get install cpufrequtils
该软件可以用来查看cpu的运行模式以及当前频率
运行
cpufreq-info
结果如下所示

cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 8.0 us.
hardware limits: 800 MHz - 2.80 GHz
available frequency steps: 2.80 GHz, 2.10 GHz, 1.60 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.80 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 2.80 GHz.
cpufreq stats: 2.80 GHz:10.37%, 2.10 GHz:0.14%, 1.60 GHz:0.56%, 800 MHz:88.93%  (6395)
analyzing CPU 1:
driver: powernow-k8
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 8.0 us.
hardware limits: 800 MHz - 2.80 GHz
available frequency steps: 2.80 GHz, 2.10 GHz, 1.60 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.80 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 800 MHz.
cpufreq stats: 2.80 GHz:37.15%, 2.10 GHz:0.10%, 1.60 GHz:0.70%, 800 MHz:62.04%  (3481)
analyzing CPU 2:
driver: powernow-k8
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 8.0 us.
hardware limits: 800 MHz - 2.80 GHz
available frequency steps: 2.80 GHz, 2.10 GHz, 1.60 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.80 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 800 MHz.
cpufreq stats: 2.80 GHz:12.35%, 2.10 GHz:0.13%, 1.60 GHz:0.65%, 800 MHz:86.87%  (7569)
analyzing CPU 3:
driver: powernow-k8
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 8.0 us.
hardware limits: 800 MHz - 2.80 GHz
available frequency steps: 2.80 GHz, 2.10 GHz, 1.60 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.80 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 800 MHz.
cpufreq stats: 2.80 GHz:32.48%, 2.10 GHz:0.12%, 1.60 GHz:0.35%, 800 MHz:67.06%  (3615)





我们要做的就是调节cpu的模式
使用
suod cpufreq-set -g 《模式》
powersave,是无论如何都只会保持最低频率的所谓“省电”模式;
userspace,是自定义频率时的模式,这个是当你设定特定频率时自动转变的;
ondemand,默认模式。一有cpu计算量的任务,就会立即达到最大频率运行,等执行完 毕就立即回到最低频率;
conservative,翻译成保守(中庸)模 式,会自动在频率上下限调整,和ondemand的区别在于它会按需分配频率,而不是一味追求最高频率;
performance,顾名思义只注重效率,无论如何一直保持以最大频率运行。

假如你选择的是自定义模式的话可以通过
sudo cpufreq-set -f 你所需要的频率
注意,此处的频率必须是以KHz为单 位,并且是可以达到的频率(也就是用cpufreq-info查看到的各个频率),cpu频率=倍频x外频。以下凡是涉及频率的一律如此。


而在自动调节下,也可以设置其上限和下限

sudo cpufreq-set -d 频率下限
sudo cpufreq-set -u 频率上限
这个可以用来超频哦~~~~~~