Saturday, June 18, 2011

Powertop 2.0 – saving power under Linux


Powertop, a tool for detecting power wasters under Linux, is about to make a generational jump: version 2.0 provides improved diagnostic options and a redesigned user interface. It also offers a simple, manual way of enabling numerous power-saving features that can noticeably extend the battery life of notebooks.
Currently available as beta version 1.98, Powertop 2.0 is nearing completion. The second generation Linux program for tracking down power wasters has been largely rewritten. Developer Arjan van de Ven explains the reasons for the rewrite in his release email for the first beta, which was released at the beginning of the year: the codebase for the first generation of Powertop had grown rather out of hand after many new features were added.
In an extensive blog posting back in August 2010, van de Ven described how Powertop users' requirements have changed over time. The program was originally intended as a niche tool for open source programmers, distribution developers and notebook owners. Over time, however, more and more Linux users started using Powertop, and the developers implemented functions that allowed users to optimise their systems with Powertop.
However, the developer said that today, three years on, distributions automatically use most of the power-saving features. As a result, Powertop is no longer as useful to end users as it was before, and the focus has shifted to system diagnostics. "With the user base moving from end users to experienced engineers, it’s time for the internals of PowerTOP to get redone", said van den Ven.

New user interface

Like earlier versions of the tool, on starting up, the second generation of Powertop provides an overview of which programs engage the CPU how often and thus shorten the time the processor can remain in power-saving sleep states. In a compact overview, the program now not only displays the processor load, it also indicates how often the graphics chip (GPU/Graphics Processing Unit) became active in the previous measuring period, and how often the Virtual File System (VFS), which offers basic file system functionality, accessed the storage media.
However, the new version provides considerably more detail about the various processor cores' sleep periods, and it also shows the status of the processor package – which includes the processor cores and the "uncore" area that contains components such as the memory controller and I/O units. The information is no longer presented on the main program page but is now located in the "Idle Stats" tab, which is accessible by pressing the right cursor key. Which clock speed is being used, how often, and whether the processor also shifts to turbo boost frequencies is shown in the "Frequency Stats" tab. The "Device Stats" tab provides a device activity overview and displays the number of transmitted network packages. Devices that don't use any power-saving mechanisms are listed as being one hundred per cent active.

Fine tuning

The last tab offers "Tunables" that allow users to enable and disable specific power-saving features – such as the auto-suspend feature for USB and audio hardware. Unfortunately, it remains unknown exactly how Powertop makes this happen; ultimately, however, it tends to use the tricks described in detail atlesswatts.org.
One of the reasons why current distributions don't automatically use all the power-saving mechanisms that are accessible via Powertop is that some of them are quite recent and only work with the latest kernel versions. However, another cause is teething problems – the H's associates at heise Open found that activating USB auto-suspend disrupted the mouse connection on one of their test computers. The audio power saver worked on the notebook they tested; but there are reports that, on some devices, the mechanism triggers audio disruptions when the HDA or AC97 chips change into, or out of, power-saving mode.

Basics

The developers have also made comprehensive changes under the bonnet and Powertop's diagnostics are now done via perf which allows the tool to utilise the Linux kernel's tracing and performance monitoring options; these options have been extended substantially over the past two years. As a consequence, Powertop's minimum kernel requirement is now Linux version 2.6.36, which includes the infrastructure that is needed for perf; some of the features even require kernel version 2.6.37, which was released early last January. These requirements are generally only met by current Linux distributions released in the past few months.
Like the previous version of Powertop, the new version can provide a rough indication of a notebook's power consumption via the ACPI usage information. However, the readings are by no means accurate to the second and tend to be sluggish – users shouldn't be too quick to draw conclusions from them.
The new version attempts to estimate the current power consumption by analysing the operating environment and comparing the results with previously measured data. These estimates become more accurate if a calibration is performed with the --calibrate command line parameter that is mentioned in the README file; the calibration run considers aspects such as the potential effects of display brightness and USB activity on power consumption.
When called with the --html parameter, the new Powertop generates an HTML report like the one that is displayed on van de Ven's web site. The idea behind this is that users can upload or email these reports so that others – for example, the developers of the distribution that is being used – can help them troubleshoot problems. CSV (Comma-Separated Values) output is on the developers' ToDo list for version 2.1. That list also contains a handful of items that need to be incorporated before version 2.0 is finalised.

No comments:

Post a Comment