推荐给好友 上一篇 | 下一篇

Ubuntu 笔记本电源管理优化指南

看到许多朋友抱怨linux电源管理很糟糕,说什么电池使用比win下短了很多。实际上linux提供很多电源优化的功能,只不过默认情况下的设置没有考虑电源使用罢了。下面我以ubuntu edgy为例,系统的讨论一下笔记本电源管理优化。

目标:最长的电池使用时间

概述

笔记本由许多不同的组件组成,各个组件的耗电不用。我们可以看到主要的耗电部件是液晶显示器、CPU、芯片组和硬盘。虽然我们可以在BIOS里面设置操作系统无关的电源管理模式,但是在操作系统之上我们可以设置一些更smart的电源管理模式自动适应各种环境。
本文分下面几个部分分别讨论各个部件的电源管理优化。

1.前提
  在讨论各个设备的电源管理优化之前,先确定我们是否满足下面一些前提条件。
BOIS
  首先你要检查一下你的BOIS的电源管理设置,先关闭所有bois支持的电源管理方式,只通过操作系统设置电源管理,然后再恢复BOIS的电源管理。
Kernel
  acpi支持,edgy默认内核是支持acpi的,如果你自定义编译了内核,记住要把电源管理相关的模块选上

Power Management Options --->
  [*] Power Management Support
  [ ] Software Suspend
  ACPI( Advanced Configuration and Power Interface ) Support --->
    [*] ACPI Support
    [ ]   Sleep States
    [ ]     /proc/acpi/sleep (deprecated)
    [*]   AC Adapter
    [*]   Battery
       Button
       Video
    [ ]   Generic Hotkey
       Fan
       Processor
         Thermal Zone
    < >   ASUS/Medion Laptop Extras
    < >   IBM ThinkPad Laptop Extras
    < >   Toshiba Laptop Extras
    (0)   Disable ACPI for systems before Jan 1st this year
    [ ]   Debug Statements
    [*]   Power Management Timer Support
    < >   ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
  CPU Frequency Scaling --->
    [*] CPU Frequency scaling
    [ ]   Enable CPUfreq debugging
    < >   CPU frequency translation statistics
    [ ]     CPU frequency translation statistics details
          Default CPUFreq governor (userspace)
    <*>   'performance' governor
    <*>   'powersave' governor
    <*>   'ondemand' cpufreq policy governor
    <*>   'conservative' cpufreq governor
    <*>   CPU frequency table helpers
     ACPI Processor P-States driver
    <*> CPUFreq driver for your processor
 
2.显示器

如上所示,LCD是最耗电的部件,这一节我们讨论如何降低LCD的耗电。
首先,尽可能调低亮度,这个不多说手动调节就可以了;
然后设置 DPMS(Display Power Management Signaling)
修改sudo vi /etc/X11/xorg.conf文件:

Section "ServerLayout"
  Identifier  [...]
  [...]
  Option  "BlankTime"  "5"  # Blank the screen after 5 minutes (Fake)
  Option  "StandbyTime"  "10"  # Turn off screen after 10 minutes (DPMS)
  Option  "SuspendTime"  "20"  # Full suspend after 20 minutes
  Option  "OffTime"  "30"  # Turn off after half an hour
  [...]
  EndSection
  [...]
  Section "Monitor"
  Identifier  [...]
  Option  "DPMS"  "true"
  [...]
 EndSection

但似乎xorg的dpms有bug不能关闭LCD,只能把屏幕变黑。
google搜索了一下发现是和acpi冲突只要重新启动acpi就可以了,手动设置屏幕关闭:

sudo /etc/init.d/acpid restart
xset dpms force off

3.cpu

移动版本的CPU支持频率和电压的动态调整,在大多数情况下你的CPU是没必要全速运行的,尤其在电池支持下,我们可以强制使CPU运行在最低频率。
在linux 2.6以后的内核就支持cpu频率的动态调整,有下面5种模式:
◆performance 将CPU频率设定在支持的最高频率,而不动态调节;
◆powersave 将CPU频率设置为最低;
◆ondemand 快速动态调整CPU频率, Pentuim M的CPU可以使用;
◆conservative 与ondemand不同,平滑地调整CPU频率,适合于用电池工作时;
◆userspace 用户模式,也就是长期以来都在用的那个模式。可以通过手动编辑配置文件进行配置;

先安装相关软件cpufrequtils:

sudo apt-get install cpufrequtils

查看你的cpu所支持的频率:

cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs tolinux@brodo.de, please.
analyzing CPU 0:
  driver: powernow-k8
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 800 MHz - 1.60 GHz
  available frequency steps: 1.60 GHz, 800 MHz
  available cpufreq governors: userspace, powersave, ondemand, conservative, performance
  current policy: frequency should be within 800 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
current CPU frequency is 800 MHz.

需要进入那个模式直接修改proc文件,比如要进入powersave模式:

sudo -s
      echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
其实有个实用程序laptop-mode可以方便的设置,在后面硬盘一节统一介绍。如果是用迅驰cpu,支持多个频率,你可以用powernowd更细化的调节cpu频率。

 



TAG: ubuntu Ubuntu 笔记本 电源 管理 指南
 

评分:0

我来说两句

seccode