From Gentoo Wiki
Jump to: navigation, search

PowerTOP is a Linux utility that can monitor and display a system's electrical power usage. It is useful as a hardware monitoring and diagnostic tool. It is among the most powerful battery stretching utilities for notebook computers.



Several kernel options must be enabled in the kernel for PowerTOP to work properly. These include: CONFIG_DEBUG_FS, CONFIG_TRACING, CONFIG_BLK_DEV_IO_TRACE, CONFIG_TIMER_STATS, CONFIG_CPU_FREQ_STAT, and CONFIG_CPU_FREQ_STAT_DETAILS.

Optionally, for wireless power saving enable: CONFIG_TRACEPOINTS.

KERNEL Enable support for PowerTOP in the kernel
Power management and ACPI options  --->
   CPU Frequency scaling  --->
      [*] CPU Frequency scaling
      <*>   CPU frequency translation statistics
      [*]     CPU frequency translation statistics details
      [*] Extra PM attributes in sysfs for low-level debugging/testing

Kernel hacking  --->
   Compile-time checks and compiler options  --->
      [*] Debug Filesystem
   [*] Kernel debugging
   [*] Collect kernel timers statistics
   [*] Tracers  --->
      [*] Support for tracing block IO actions

If the above options have not properly been enabled Portage will display warning messages at the end of the emerge. If help is required for upgrading the kernel while enabling the above options, be sure to see the kernel upgrade article!

USE flags

USE flags for sys-power/powertop tool that helps you find what software is using the most power

X Add support for X11 global
nls Add Native Language Support (using gettext - GNU locale utilities) global
unicode Add support for Unicode global


After setting USE flags, emerge PowerTOP:

root #emerge --ask sys-power/powertop


PowerTOP does not have any configuration other than passing options via the command-line.


Calibration can be performed in order for PowerTOP to gain an understanding of the system:

root #powertop --calibrate



root #powertop --help
Usage: powertop [OPTIONS]

--debug 		 run in "debug" mode
--version 		 print version information
--calibrate 		 runs powertop in calibration mode
--auto-tune 		 Sets all tunable options to their GOOD setting
--extech[=devnode] 	 uses an Extech Power Analyzer for measurements
--html[=FILENAME] 	 generate a html report
--csv[=FILENAME] 	 generate a csv report
--time[=seconds] 	 generate a report for 'x' seconds
--iteration[=iterations] number of times to run each test
--workload[=workload] 	 file to execute for workload
--quiet 		 suppress stderr output
--help 			 print this help menu

For more help please refer to the README


Could not find a Makefile in the kernel source directory

After an emerge a message similar to the following message may be displayed:

CODE Post emerge warning message
* Could not find a Makefile in the kernel source directory.
 * Please ensure that /usr/src/linux points to a complete set of Linux sources
 * Unable to calculate Linux Kernel version for build, attempting to use running version
 *   CONFIG_DEBUG_FS:    is not set when it should be.
 *   CONFIG_TRACEPOINTS:         is not set when it should be.
 *   CONFIG_BLK_DEV_IO_TRACE:    is not set when it should be.
 *   CONFIG_TIMER_STATS:         is not set when it should be.
 *   CONFIG_TRACING:     is not set when it should be.
 * Please check to make sure these options are set correctly.
 * Failure to do so may cause unexpected problems.

This warning indicates the PowerTOP ebuild has attempted to verify a successful operating environment for the PowerTOP software package. In order to be sure PowerTOP will work as intended, at the end of the emerge process, a check is ran against the current kernel source configuration. In the case of the above message two warnings were provided:

  1. No kernel sources have been detected. This can happen as a result of running an emerge --depclean or failed to have a specific kernel set using the eselect kernel command.
  2. Since no kernel sources have been detected Portage was not able to scan the kernel's .config file to determine if the correct features have been enabled in the kernel. According to the error message above, five features are not set. The features may or may not be set in the current running kernel. Portage is simply making the user aware there is no way to verify these features have been set without a .config file. If PowerTOP can perform some functions but not others, be sure all the kernel features listed have been enabled. For more information on how to do so consult the kernel configuration article.

See also

External resources