Use PowerTop to optimize powersettings

A handy tool for looking at your powercomumpotion is PowerTop. It gives detailed information and gives some advice about how to reduce power consumption.
After installign powertop, start it up as root and it will give you information about all kinds of parameters, like:
- how often is your CPU waken-up ? And by what processes?

In order for PowerTop to use you need to have “debug Filesystem” enabled in your kernel; If not activate it under the ‘kernel hacking’-section in kernel-config, and recompile your kernel.

Making PowerTop changes permanent

PowerTop gives advice about some powersaving featurs which you can toggle in PowerTop under ‘tunables’. However, changes made there are not permanent, so you need to now the commands that PowerTop uses to switch-on all those features.

Luckily, you can extract them from PowerTop: Create a powertop-advice HTML-file using:
powertop –html

This generates a file called ‘PowerTOP.html’, which contains the info in HTML-format so it is readable using a webbrowser.
Basically, PowerTop uses “echo” to send a “1″ of a “y” to various devicenodes in order to activate powersaving features). So, in order to extract the commands, we grep for ‘echo’ :

grep ‘echo’ PowerTOP.html | sed ‘s/.*\(echo.*\);.*/\1/g’

which gives in my case:

Mediaserver# grep ‘echo’ PowerTOP.html | sed ‘s/.*\(echo.*\);.*/\1/g’
echo ’1′ > ‘/sys/module/snd_hda_intel/parameters/power_save’
echo ‘min_power’ > ‘/sys/class/scsi_host/host0/link_power_management_policy’
echo ‘auto’ > ‘/sys/bus/usb/devices/1-1/power/control’
echo ‘auto’ > ‘/sys/bus/usb/devices/3-2/power/control’
echo ‘auto’ > ‘/sys/bus/pci/devices/0000:00:13.0/power/control’
echo ‘auto’ > ‘/sys/bus/pci/devices/0000:00:01.1/power/control’

In order to make them permanent, I added them to my startup sequence by creating a file “/etc/local.d/PowerSafeSettings.start” containing the above commands.

PS: To get them in a file:
” grep ‘echo’ PowerTOP.html | sed ‘s/.*\(echo.*\);.*/\1/g’ > “

This entry was posted in Linux. Bookmark the permalink.