PowerTOP Primer

ID 标签 689583
已更新 4/23/2015
版本 Latest
公共

author-image

作者

Note: All information from this article has been taken from https://01.org/powertop/
 
Computer programs can make your computer use more power. PowerTOP is a Linux tool that helps you find those programs that are misbehaving while your computer is idle. The application that misbehaved the most was the Linux kernel. However, as of version 2.6.21, the Linux kernel went tickless, and no longer has a fixed 1000Hz timer tick. The result (in theory) is huge power savings because the CPU stays in low power mode for longer periods during system idle. 
 
However... there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing at saving power, and which components are the biggest problems.
 


PowerTOP has these four basic goals:

  • Show how well your system is using the various hardware power-saving features
  • Show you the culprit software components that are preventing optimal usage of your hardware power savings
  • Help Linux developers test their application and achieve optimal behavior
  • Provide you with tuning suggestions to achieve low power consumption

About PowerTOP

 
PowerTOP is a Linux tool that finds the software component(s) that make your laptop use more power than necessary while it is idle. As of Linux kernel version 2.6.21, the kernel no longer has a fixed 1000Hz timer tick. This will (in theory) give a huge power savings because the CPU stays in low power mode for longer periods of time during system idle.
However... there are many things that can ruin the party, both inside the kernel and in userspace. PowerTOP combines various sources of information from the kernel into one convenient screen so that you can see how well your system is doing, and which components are the biggest problem.
 
 

Requirements

 
For PowerTOP to work best, use a Linux kernel with the tickless idle (NO_HZ) feature enabled (version 2.6.21 or later). 32-bit kernels have support for tickless idle as of version 2.6.21; 64-bit kernels have this feature in version 2.6.23 and later.
 
PowerTOP works best on a laptop computer, or at least a computer with an Intel mobile processor (certain small non-laptop devices also contain a mobile processor). For best results, when using PowerTOP on a laptop, do so when running on battery.
 
Please see the PowerTOP FAQ for more information.
 

A quick intro



The following screenshot shows PowerTOP running on a laptop:
 
screenshot2_small.gif
 

C state information

 
C-states are operating modes of the CPU when it's idle. The higher the C-state number, the less power is used by the CPU; however the longer it will take to get the CPU back to executing instructions. C0 is special; in C0, the CPU is actually executing instructions. In all other C-states, the CPU is idle and not executing instructions.
To get decent power savings during idle, the CPU should be in C3 or C4 most of the time. In addition, the longer the average time in these C-states, the more power is saved. Ideally, your CPU spends at least 95% of its time in C4, for an average of 50 or more milliseconds.
In the screenshot, the laptop isn't doing very well. Most of the time the processor is in C2, and then only for an average of 4.4 milliseconds at a time. If the laptop spent most of its time in C4 for at least 20 milliseconds, the battery life would have been approximately one hour longer.
 

Wakeups per second

 
The "Wakeups per second" line is another indicator for how well your laptop is doing in terms of getting power savings: the lower the number the better. When running a full GNOME desktop, 3 wakeups per second is achievable.
 
The laptop in the screenshot is not doing very well (193 is a lot more than 3!), which obviously matches the C-state results.
 

Power usage

 
When your laptop is running on battery, PowerTOP uses ACPI to collect information on how much power you are currently using. In addition, PowerTOP calculates an estimate for how many hours of battery you have left.
 
Note: If you're not running on battery, or not running PowerTOP on a laptop, this information will not be available.
 

Top causes for wakeups

 
Now that we know the laptop is not doing well in terms of power usage, it's time for the interesting part: what is causing the system to be more active than needed.
 
PowerTOP displays the top 10 activities on the computer during the sampling period. In the screenshot, the top 3 items are hardware interupts from devices. This also shows one of the key reasons the laptop isn't doing well-- it was connected to the network via an ethernet cable, yet the ipw2200 wireless driver was waking the CPU up very frequently. Also shown is a bug in the i915 graphics driver and activity by the i8042 component (this is the PS/2 chip; the activity shown is the mouse moving to make the screenshot).
 
The screenshot also shows that on this laptop, Firefox, xchat and Xorg are very active and causing a significant amount of power-consuming activity.
 

Suggestions

 
The last section of the screen displays suggestions -- PowerTOP has detected that the running kernel is configured suboptimally and suggests how to improve this.
 

Download and building

 
See the download page to get the PowerTOP software and for build instructions.
 

Getting help

 
If you're puzzled by PowerTOP, or have questions about how to fix certain issues, use the mailing list or the IRC channel. For more information about these, check the  Home page on the PowerTOP site.
 

Already known & fixed issues

 
We have already fixed many issues that exist in today's distributions, and by the time you read this, others will have used PowerTOP to find and fix issues as well. So before going to the mailing list, take a look at the  Get Involved page and read about the existing fixes, tips, and tricks.
"