ubuntu电源管理

2019-07-13 21:50发布

ubuntu电源管理

这是我的硬件数据:
CPU:英特尔 酷睿i3 双核 M 370 2.40GHz 核心显卡:Intel Corporation Core Processor Integrated Graphics Controller 独立显卡:NVIDIA Corporation GF108 [GeForce GT 425M] 主硬盘:西部数据 500GB 5400 转/分钟 操作系统: ubuntu 12.04LTS


Table of Contents


1 显示器


显示器这块历来是耗电大户,但是很多时候,你不可能为了省电把屏幕调到很暗的程度。毕竟我们拿电脑是来工作的,不是受虐的。所以,亮度调节这块,自己决定。而且ubuntu 12.04可以使用键盘热键调节,不需要配置就可以了。

2 CPU


我使用了cpufreq-info查看了CPU的情况,下面是我个人电脑上面CPU的数据:
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 10.0 us. hardware limits: 933 MHz - 2.40 GHz available frequency steps: 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz, 1.07 GHz, 933 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 933 MHz and 2.40 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 933 MHz (asserted by call to hardware). cpufreq stats: 2.40 GHz:3.20%, 2.27 GHz:0.05%, 2.13 GHz:0.03%, 2.00 GHz:0.05%, 1.87 GHz:0.08%, 1.73 GHz:0.06%, 1.60 GHz:0.12%, 1.47 GHz:0.12%, 1.33 GHz:0.10%, 1.20 GHz:0.09%, 1.07 GHz:0.19%, 933 MHz:95.92% (1694) analyzing CPU 1: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 1 maximum transition latency: 10.0 us. hardware limits: 933 MHz - 2.40 GHz available frequency steps: 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz, 1.07 GHz, 933 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 933 MHz and 2.40 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 933 MHz (asserted by call to hardware). cpufreq stats: 2.40 GHz:2.50%, 2.27 GHz:0.04%, 2.13 GHz:0.03%, 2.00 GHz:0.04%, 1.87 GHz:0.02%, 1.73 GHz:0.04%, 1.60 GHz:0.03%, 1.47 GHz:0.08%, 1.33 GHz:0.04%, 1.20 GHz:0.04%, 1.07 GHz:0.13%, 933 MHz:97.01% (1056) analyzing CPU 2: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 2 maximum transition latency: 10.0 us. hardware limits: 933 MHz - 2.40 GHz available frequency steps: 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz, 1.07 GHz, 933 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 933 MHz and 2.40 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 933 MHz (asserted by call to hardware). cpufreq stats: 2.40 GHz:3.67%, 2.27 GHz:0.08%, 2.13 GHz:0.05%, 2.00 GHz:0.05%, 1.87 GHz:0.04%, 1.73 GHz:0.10%, 1.60 GHz:0.14%, 1.47 GHz:0.15%, 1.33 GHz:0.12%, 1.20 GHz:0.13%, 1.07 GHz:0.32%, 933 MHz:95.14% (1855) analyzing CPU 3: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 3 maximum transition latency: 10.0 us. hardware limits: 933 MHz - 2.40 GHz available frequency steps: 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47 GHz, 1.33 GHz, 1.20 GHz, 1.07 GHz, 933 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 933 MHz and 2.40 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 933 MHz (asserted by call to hardware). cpufreq stats: 2.40 GHz:2.24%, 2.27 GHz:0.02%, 2.13 GHz:0.02%, 2.00 GHz:0.02%, 1.87 GHz:0.03%, 1.73 GHz:0.02%, 1.60 GHz:0.02%, 1.47 GHz:0.03%, 1.33 GHz:0.03%, 1.20 GHz:0.11%, 1.07 GHz:0.05%, 933 MHz:97.41% (795)
可以看到这个4核CPU的可用工作频率在933MHZ到2.40GHZ之间,而由cpufreqstats一块可以清楚的知道,4个CPU占97%左右的时候都是处在933MHZ的最低水平,所以,CPU频率这一块也不需要自动调节,它自动调节功能已经可以了。


3 显卡


使用lspci | grep VGA可以查看个人电脑上面的显卡类型,我的数据如下:
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 18) 01:00.0 VGA compatible controller: NVIDIA Corporation GF108 [GeForce GT 425M] (rev ff)
从侦测数据上可以看到,我的电脑上面安装了核心显卡和N卡。
使用sudo cat /sys/kernel/debug/vgaswitcheroo/switch命令可以查看当前使用那一个显卡,我的数据如下:
0:IGD:+:Pwr:0000:00:02.0 1:DIS: :Off:0000:01:00.0
其中第一行的IGD Pwr表示当前使用的是核心显卡(这是我配置之后的)。
一般情况下,ubuntu会默认使用独显,所以会非常耗电。这里最重要的一步就是关闭独显,只使用核心显卡。下面的命令可以关闭独显:
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
使用sudo cat /sys/kernel/debug/vgaswitcheroo/switch再次查看,如果出现如下数据即表示关闭独显成功:
0:IGD:+:Pwr:0000:00:02.0 1:DIS: :Off:0000:01:00.0
在这里,如果要想开机时就关闭独显,可以在/etc/rc.local写入刚才命令即可。

4 硬盘


据说,ubuntu的电源管理有问题,使用如下命令可以查看:
sudo smartctl --all /dev/sda | grep 193 193 Load_Cycle_Count 0x0032 198 198 000 Old_age Always - 8199
如果最后那个数字(我的是8199)增长很快,你就得注意了,这个上限是60W次,超出之后硬盘就报废了。
下面的脚本可以检测在10分钟时间它的增长速度:
smartctl --all /dev/sda | grep 193;sleep 600;smartctl --all /dev/sda | grep 193
后记:实际上这个传闻比较不真实。因为的我的机器在8.18号测的数据是8199,而今天就是我发这篇博客到csdn的时候,上面的数据是9939.所以,真假自己看诶揣摩出来。

Date: 2012-08-18 六 Author: lishuo Org version 7.9.1 with Emacs version 23 Validate XHTML 1.0