Saving Energy with PowerTOP2.0
The PowerTOP tool developed by Intel helps you save power. In version 2.0, it can also handle GPUs and offers advanced tracking features.
If you use both Linux and Windows on a notebook, you will probably notice that the battery lasts longer under Windows, which implies that Linux does not make optimum use of power-saving features offered by the CPU.
This problem occurs most often with increasing laptop age or by distribution installed; however, you can take control of your computer’s power usage through sometimes painstaking and generally very individual fine-tuning. Getting there is much easier if you know the capabilities of advanced CPUs and the kernel. Expert advice on these topics can be found in PowerTOP, developed by Intel’s Open Source Division.
Then and Now
PowerTOP was originally developed by Intel to measure the power consumption of their CPUs and offer optimization suggestions. Since 2007, however, PowerTOP has been available for free download under GPLv2, with support for AMD, ARM, and UltraSPARC processors in addition to those by Intel.
Originally, PowerTOP only showed the current and estimated long-term consumption of active processes, which made it possible to discover programs that unnecessarily woke the processor and hard disk from sleep.
Then, Intel began implementing more and more functions and offering more and more optimizations, which led to a steadily growing codebase. These changes prompted the head developer, Arjan van de Ven, to rewrite large parts of the code. Because modern distributions now automatically use most energy-saving features, PowerTOP is now used mostly for system diagnostics, although it still makes suggestions for saving energy.
A first beta version of PowerTOP 2 has been available for testing since the beginning of this year, and since the beginning of May, it has been officially available for download on the PowerTOP 2.0 project download page. Almost all distributions already include PowerTOP.
In the repositories of Ubuntu 12.04, you will find both the beta version 1.97 and the stable version 1.13 of the old series, of which the beta package already utilizes the PowerTOP 2 base code. Both can be installed with Synaptic or via
apt-get install powertop
apt-get install powertop-1.13
PowerTOP v1.13 only makes sense on computers with older distributions, if at all, because since at least version 2.6.21, the kernel no longer has a fixed 1,000Hz timer tick. This in itself would theoretically result in a large energy savings because the CPU stays longer in power-saving mode when idle.
To benefit from the latest features, you should use version 2.0 of the source code released May 10 this year. PowerTOP expects curses-base, curses-am, or libcurses5, as well as libpci, libnl-dev, automake, autoconf, and dh-autoreconf as dependencies. Install these first via your package manager, then unpack the PowerTOP sources with the archive manager of your distribution or with
$ tar -xfzv powertop-2.0.tar.bz2
in a directory of your choice. Next, navigate to that directory and enter the following commands:
$ sudo ./autogen.sh $ sudo ./configure $ sudo make $ sudo make install
to complete the installation.
Like all previous versions, PowerTOP 2.0 diagnoses the CPU, as well as other devices and software, and displays the approximate power consumption with the help of ACPI usage information. Additionally, the current version now also uses the perf subsystem to read hardware information from the kernel (see the box “The Linux Performance Counter Subsystem”).
New to version 2.0 are the tracking features, which help determine which components appear to be problematic in terms of energy consumption. PowerTOP 2.0 also reports GPU measures if the kernel provides this data, as well as new drivers, such as the i915 drivers for Intel chipsets and CPUs.
The application also is now able to query a number of WLAN interfaces and measure USB hot plugging in real time. Additionally, the developers improved the ability to get data from notebook batteries. The second big improvement of the program lies in its reporting abilities; for example, PowerTOP now generates reports in HTML and soon (depending on the version) in CSV format.
The third great innovation compared with the previous version is that the ncurses interface has been completely revised and is distributed over five tabs (Figure 1).
Overview lists all active processes sorted by power consumption. The Idle stats tab delivers information on CPU usage or time spent in the various states of idleness in ACPI-capable CPUs (C-states). In modern multicore CPUs from Intel, these are divided into nine C-states (modes) from C0 (full operation) to C6 (voltage shutoff) (see the “C-States” box).
Ideally (from an energy savings perspective), the CPU should spend 95 percent of the time in C-states as high as possible. The C-state classification as described here applies only to Intel processors. AMD processors, for example, do not support the C-states C2E, C5, and C6, and other CPU manufacturers or older processors also do not support all nine C-states.
At the top of the PowerTOP display, you can see how long the CPU remains in a certain C-state, which sometimes allows an estimate of the effect of changing kernel options. The Frequency stats register, however, is dedicated to CPU load. The Device stats tab gives a list of individual devices and their power consumption, and you can also see whether it is a process or a device (driver). The last tab, Tunables, shows settings for optimal energy use by the installed hardware and obtains its information from the virtual filesystem under sysfs.
As already mentioned, distributions today use most power-saving features automatically, which is why the use of PowerTOP 2.0 has been shifting toward diagnostic tasks. For this reason, most power information reported in a previous article on the topic in the context of PowerTOP 1.1.13 is worth reading. As far as C-states are concerned, however, it is largely obsolete concerning the usefulness of early versions of PowerTOP.
When you launch PowerTOP 2.0 for the first time, not much seems to have changed at first glance because the tool shows the Overview tab on startup, which is similar to the display from earlier versions. Here, you can see which programs occupy the processor how often (Figure 1), which ultimately reduces the time in which the CPU can linger in power-saving sleep.
The overall workload of the processor is shown above the process list (as in past versions). Next, and new to version 2.0, graphics chip operations during the last measurement interval are reported (0.0 GPU in Figure 1), as well as how often the Virtual File System (VFS) accessed the hard disk (0.0).
The Usage status refers to the entire processor package, consisting of the processor cores and the uncore area, with the memory controller and the I/O units. The second tab, Idle stats, gives more detailed information about the sleep times of the various processor cores (Figure 2).
The next tab, Frequency stats, shows how often particular frequencies are in use or how often (percentage) the CPU has turned on the turbo boost (Figure 3).
The Device stats tab gives an overview of the activity of individual devices (Figure 4). Devices that do not support or use power-saving technologies always show 100 percent.
In addition to pure diagnostics, the last tab, Tunables presents settings with which certain power-saving functions can be turned on or off, such as the autosuspend for USB. Activating Tunables, that is, applying the respective PowerTOP suggestion, is achieved by pressing the Enter key (Figure 5).
Intel does not reveal the details of what PowerTOP does. However, a number of tips can be found at LessWatts.org, and it is not likely that Intel has invented anything substantially new. In any case, all settings will be lost when you restart the computer. Apart from that, the README file in the directory of the unpacked PowerTOP sources explains more details and possible parameters. For example, calling up powertop --calibrate will run a calibration cycle to increase the accuracy of energy consumption estimates. The calibration includes such things as the influence of display brightness or USB activity. To generate an HTML report in the user’s home directory, use the --html parameter (Figure 6). Likewise, the --csv option creates a CSV-formatted report.
Although the power-saving functions of PowerTOP are not as necessary for modern distributions, it is still a useful diagnostic tool. Moreover, some users might still be using older distributions, and not every distro activates all power-saving functions. The reasons to use PowerTOP can be manifold. Apart from the fact that the ACPI specification is unmistakably tailored for use with Windows, some power management features, such as the audio power-saving function, still have teething problems.
Azure CTO says Redmond has already considered the unthinkable.
Lead developer quells rumors that the Debian version is slated for center stage.
MSBuild is now just another GitHub project as Redmond continues its path to the light.
Malware could pass data and commands between disconnected computers without leaving a trace on the network.
New rules emphasize collegiality in coding.
Upstart lands in the dust bin as a new era begins for Linux.
HP's annual Cyber Risk report offers a bleak look at the state of IT.
But what do the big numbers really mean?
.NET Core execution engine is the basis for cross-platform .NET implementations.
The Xnote trojan hides itself on the target system and will launch a variety of attacks on command.