PowerTOP

PowerTOP is Article description::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.

Kernel
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 (was removed in kernel 4.11), CONFIG_CPU_FREQ_STAT , and CONFIG_CPU_FREQ_STAT_DETAILS.

Optionally, for wireless power saving enable: CONFIG_TRACEPOINTS.

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!

Emerge
After setting USE flags, PowerTOP:

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

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

Could not find a Makefile in the kernel source directory
After an emerge a message similar to the following message may be displayed:

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 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  or failed to have a specific kernel set using the  command.
 * 2) Since no kernel sources have been detected Portage was not able to scan the kernel's  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  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.

External resources

 * https://www.linux.com/learn/powertop-finds-power-hogs-your-linux-pc - A Linux.com article on using PowerTOP to measure large power consumers.
 * https://01.org/sites/default/files/page/powertop_users_guide_201406.pdf - A PowerTOP user guide writen by two Intel employees (PDF).