linux 电源管理 命令,GNU/Linux 电源管理 : PowerTOP

aa7aad86a30c9793ebb12f2a8ad78056.png▲ PowerTOP 的起始画面。

开始前请先安装 powertop。# Debian, Ubuntu

$ sudo aptitude install powertop

# CentOS, RHEL, Fedora

$ sudo yum install powertop

# Arch Linux

$ sudo pacman -S powertop

请使用 Tab, Shift + Tab 或方向键 ←, → 切换至 Tunables 分页 ↑, ↓ 上下移动,于欲调校的项目按下 Enter 进行调校,当所有状态显示为 Good 后即可按下 q 离开。

b21460d58e05fa7b3f0c85a577425b3b.png▲ 调校前的 Tunables。

c1f523ad20a150c6717dc1f51724bfab.png▲ 调校后的 Tunables。

PowerTOP 本身并无储存功能,但我们可以借由 powertop '--html' 产生的报告来调校系统,甚至于开机时载入这些设定。$ sudo powertop --html

Loaded 58 prior measurements

Cannot load from file /var/cache/powertop/saved_parameters.powertop

Preparing to take measurements

Measuring 1 time(s) for 20 seconds each

PowerTOP outputing using base filename powertop-20130915-231821.html

0e8b2c057575b85e4da94ebeb0ddb758.png▲ 此报告将依个人环境而有所不同,其各项目的详细说明可参考 Power saving - ArchWiki 一文。

接著将调校的指令贴到一个 shell script 打包起来。$ sudo vi /usr/local/bin/powersave

#!/bin/bash

# PowerTop conifg for ThinkPad T410 on Debian Wheezy.

# Wireless Power Saving for interface wlan0

iw dev wlan0 set power_save off

# Enable SATA link power management for /dev/sda

echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';

# NMI watchdog should be turned off

echo '0' > '/proc/sys/kernel/nmi_watchdog';

# VM writeback timeout

echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

# Enable Audio codec power management

echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';

# Autosuspend for USB device Biometric Coprocessor [UPEK]

echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control';

# Runtime PM for PCI Device Ricoh Co Ltd MMC/SD Host Controller

echo 'auto' > '/sys/bus/pci/devices/0000:0d:00.0/power/control';

# Runtime PM for PCI Device Intel Corporation Core Processor PCI Express x16 Root Port

echo 'auto' > '/sys/bus/pci/devices/0000:00:01.0/power/control';

# Runtime PM for PCI Device Intel Corporation 82577LM Gigabit Network Connection

echo 'auto' > '/sys/bus/pci/devices/0000:00:19.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller

echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset High Definition Audio

echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4

echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control';

# Runtime PM for PCI Device Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller

echo 'auto' > '/sys/bus/pci/devices/0000:0d:00.3/power/control';

# Runtime PM for PCI Device Intel Corporation Centrino Wireless-N 1000 [Condor Peak]

echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset SMBus Controller

echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem

echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.6/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller

echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';

# Runtime PM for PCI Device NVIDIA Corporation GT218 [NVS 3100M]

echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller

echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1

echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5

echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.4/power/control';

# Runtime PM for PCI Device NVIDIA Corporation High Definition Audio Controller

echo 'auto' > '/sys/bus/pci/devices/0000:01:00.1/power/control';

# Runtime PM for PCI Device Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2

echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';

# Wake-on-lan status for device eth0

#ethtool -s eth0 wol d;

给予执行权限。$ sudo chmod +x /usr/local/bin/powersave

因调校指令皆需管理者权限才可执行,若想省下打密码的功夫可参考 Firestarter 开机不用再次输入密码 一文修改。$ sudo visudo

......

jonny ALL= NOPASSWD:/usr/local/bin/powersave

现在开机时只需使用 sudo powersave 即可手动切换至省电模式。

※ 注:请依个人需求自行调整,若造成系统不稳还请自行斟酌。

资料来源1. 感谢 theJian 回报,powertop v2.5 之后切换 Tunables 分页的功能键已从方向键 ←, → 改为 Tab 和 Shift + Tab。↩

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值