Difference between revisions of "Powertop"

From ArchWiki
Jump to: navigation, search
m (View Power Setings)
Line 82: Line 82:
  
 
{{Note|Kernel options are not mentioned.}}
 
{{Note|Kernel options are not mentioned.}}
 +
 +
 +
=== View Power Setings ===
 +
This function shows various power settings.  Note you either must be root or you must have sudo.
 +
 +
{{bc|<nowiki>function aa_power_settings ()
 +
{
 +
  sudo bash -c '
 +
    for i in `find /sys/devices -name "bMaxPower"`;
 +
    do
 +
        for ii in `find $i -type f`;
 +
        do
 +
            bd=`dirname $ii`;
 +
            busnum=`cat $bd/busnum`;
 +
            devnum=`cat $bd/devnum`;
 +
            title=`lsusb -s $busnum:$devnum`;
 +
            echo -e "\n\n+++ $title\n  -$bd\n  -$ii";
 +
            for ff in `find $bd/power -type f ! -empty 2>/dev/null`;
 +
            do
 +
                v=`cat $ff 2>/dev/null|tr -d "\n"`;
 +
                [[ ${#v} -gt 0 ]] && echo -e " `basename $ff`=$v";
 +
                v=;
 +
            done | sort -g;
 +
        done;
 +
    done;
 +
    echo -e "\n\n\n+++ Kernel Modules\n";
 +
    for m in `command lspci -k|sed -n "/in use:/s,^.*: ,,p"|sort -u`;
 +
    do
 +
        echo "+ $m";
 +
        systool -v -m $m 2> /dev/null | sed -n "/Parameters:/,/^$/p";
 +
    done
 +
  ';
 +
}</nowiki>}}

Revision as of 00:34, 1 May 2012

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary link Template:Article summary link Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary end

PowerTOP is a tool provided by Intel to enable various powersaving modes in userspace, kernel and hardware. It is possible to monitor processes and show which of them are utilizing the CPU and wake it from its Idle-States.

Installation

Install package powertop, available in Official Repositories.

Alternatively, there is a newer, more sophisticated version available from the powertop2AUR. This is a "beta release of PowerTOP 2.0". For more information, see the Release Announcement.

Known bugs

No ACPI Power Usage Estimate Available

In kernel version 3.0+, PowerTOP doesn't give a power usage estimate. This is because in these kernel versions there was a removal of ACPI_PROCFS_POWER in the standard kernel configuration in which PowerTOP relied upon in order to give the estimate. PowerTOP 2.0 in AUR is patched to fix this.

Tips and tricks

PowerTOP suggests a few methods to reduce the power consumption further, you may want to apply them automatically at boot, e.g. by putting them into rc.local.

Note: It may be more straightforward to install/configure other power management packages such as Laptop Mode Tools first and then come back to PowerTOP to tie up loose ends. PowerTOP may suggest a manual intervention for something that is accomplished with automatically by other power management tools. For example, if you added a PowerTOP suggestion to your rc.local file and then later installed Laptop Mode Tools you could end up applying the same fix twice each boot.

Noatime Mount Option

See Fstab.

AC97

echo 1 > /sys/module/snd_ac97_codec/parameters/power_save

Bluetooth

Blacklist the hci_usb module if the driver is loaded automatically.

CPU Scaling

To activate the ondemand CPU scaling governor for all CPU's:

for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo ondemand > $i; done;

See also CPU Frequency Scaling.

CPU Scheduler

echo 1 > /sys/devices/system/cpu/sched_mc_power_savings

Intel HDA

echo 1 > /sys/module/snd_hda_intel/parameters/power_save
Note: On some machines, turning on power_save might actually use *more* power. For instance, an Acer AspireOne ZG5 uses almost 30% (!) more power with power_save on than with the sound card simply muted.
Tip: Turning on power saving might make the audio slow to respond – e.g. you might start playing a sound clip or a song and the speakers will not turn on until several seconds later (and it might appear as if the sound has stopped working entirely). If you encounter this, try setting up a hotkey to turn power saving on and off for the audio, or only enable it when running on battery (and do your audio editing plugged in).

Laptop Mode

echo 5 > /proc/sys/vm/laptop_mode

NMI Watchdog

echo 0 > /proc/sys/kernel/nmi_watchdog

Runtime Power Management

for i in `find /sys/devices/*/power/control`; do echo auto > $i; done;

SATA Active Link Powermanagement

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

USB Autosuspend

To enable USB autosuspend after 2 seconds of inactivity:

for i in `find /sys/bus/usb/devices/*/power/level`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;

VM Writeback Time

To set the VM dirty writeback time to 15 seconds, run:

echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

Wake on LAN

To disable Wake on LAN on eth0:

ethtool -s eth0 wol d

Wireless powersaving

iwconfig wlan0 power on
Note: Kernel options are not mentioned.


View Power Setings

This function shows various power settings. Note you either must be root or you must have sudo.

function aa_power_settings ()
{ 
  sudo bash -c '
    for i in `find /sys/devices -name "bMaxPower"`;
    do
        for ii in `find $i -type f`;
        do
            bd=`dirname $ii`;
            busnum=`cat $bd/busnum`;
            devnum=`cat $bd/devnum`;
            title=`lsusb -s $busnum:$devnum`;
            echo -e "\n\n+++ $title\n  -$bd\n  -$ii";
            for ff in `find $bd/power -type f ! -empty 2>/dev/null`;
            do
                v=`cat $ff 2>/dev/null|tr -d "\n"`;
                [[ ${#v} -gt 0 ]] && echo -e " `basename $ff`=$v";
                v=;
            done | sort -g;
        done;
    done;
    echo -e "\n\n\n+++ Kernel Modules\n";
    for m in `command lspci -k|sed -n "/in use:/s,^.*: ,,p"|sort -u`;
    do
        echo "+ $m";
        systool -v -m $m 2> /dev/null | sed -n "/Parameters:/,/^$/p";
    done
  ';
}