ubuntu電源管理

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


1 顯示器


顯示器這塊歷來是耗電大戶,但是很多時候,你不可能爲了省電把屏幕調到很暗的程度。畢竟我們拿電腦是來工作的,不是受虐的。所以,亮度調節這塊,自己決定。而且ubuntu 12.04可以使用鍵盤熱鍵調節,不需要配置就可以了。


2 CPU


我使用了cpufreq-info查看了CPU的情況,下面是我個人電腦上面CPU的數據:


cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章