The sys admin's daily grind: PowerTOP

Downstream


Beep and power off! Large displays and faster CPUs seemingly wipe out the benefits of advances in battery technology. PowerTOP helps power hogs keep their laptops running without mains power.

By Charly Kühnast

Linux introduced the tickless kernel in version 2.6.21 (or 2.6.23 for 64-bit machines); that is, the kernel does away with the legacy fixed 250Hz timer. Theoretically, this should increase the battery running time for laptops because the CPU can stay in power-saving mode longer.

In reality, the kernel is not the only factor: drivers, daemons, and applications can also spoil your power-saving strategy, making the new kernel's contribution virtually useless.

Meet PowerTOP

Enter a global player from Silicon Valley, a player whose commitment to the open source community deserves much praise - Intel not only makes Linux users happy with graphics drivers, but also with tools like PowerTOP [1]. Out of the box, PowerTOP will only work with recent distributions. If you have anything else, you will need to configure and build a new kernel.

Output

The output from PowerTOP in Figure 1 shows the C states in the top left. The higher this mode number, the less power the machine consumes.

Figure 1: PowerTOP not only monitors the power consumption of the kernel and applications but also gives users environmentally friendly tips.

On the right, you can see the P states; this value shows the different power consumption levels for CPUs that gear their clock speeds to match the current load. The line below is important because it tells you how often the system wakes up the CPU per second - that is, from a battery-friendly C state. Intel claims that you can reduce this number to less than 20 with little effort.

One line lower, PowerTOP displays the wattmeter and forecasts how long your battery is likely to last. Finally, the tool ranks overactive modules in a list of shame and, as the icing on the cake, gives users practical tips as to which settings are really worth tinkering with. The most effective settings typically relate to the kernel. For example, PowerTOP recommends enabling CONFIG_USB_SUSPEND, a USB power-saving mode that can save you about one watt. More tips and hints are available online [2].

Power Hogs

Tinkering with the kernel is easy, but what about applications? X.org heads the list of power hogs on many systems but is actually an innocent bystander, with applications like Firefox or Gaim firing the X server. To keep these applications in check, I decided to patch and build them myself to make sure they let the CPU sleep. Working modifications for Firefox, Gaim, Evolution, and other environmentally unfriendly programs are available online [3].

So far so good, but don't expect miracles. Even if you keep to the tips and apply the patches, your battery life is unlikely to skyrocket. And software patches can't help with power hogs like your laptop display. On the other hand, an hour of extra battery power could make the difference between frustration at missing a flight or enjoying the airport hotspot. Happy hog hunting!

INFO
[1] PowerTOP: http://www.lesswatts.org/projects/powertop/
[2] Tips and tricks: http://www.lesswatts.org/tips/
[3] Power-saving patches for standard applications: http://www.lesswatts.org/projects/powertop/known.php
THE AUTHOR

Charly Kühnast is a Unix System Manager at the data center in Moers, near Germany's famous River Rhine. His tasks include ensuring firewall security and availability and taking care of the DMZ (demilitarized zone).