Chapter 16. Managing power consumption with PowerTOP As a system administrator, you can use the PowerTOP tool to analyze and manage power consumption. 16.1. The purpose of PowerTOP PowerTOP is a program that diagnoses issues related to power consumption and provides suggestions on how to extend battery lifetime. The PowerTOP tool can provide an estimate of the total power usage of the system and also individual power usage for each process, device, kernel worker, timer, and interrupt handler. The tool can also identify specific components of kernel and user-space applications that frequently wake up the CPU. Red Hat Enterprise Linux 8 uses version 2.x of PowerTOP . 16.2. Using PowerTOP Prerequisites To be able to use PowerTOP , make sure that the powertop package has been installed on your system: 16.2.1. Starting PowerTOP Procedure To run PowerTOP , use the following command: Important Laptops should run on battery power when running the powertop command. 16.2.2. Calibrating PowerTOP Procedure On a laptop, you can calibrate the power estimation engine by running the following command: Let the calibration finish without interacting with the machine during the process. Calibration takes time because the process performs various tests, cycles through brightness levels and switches devices on and off. When the calibration process is completed, PowerTOP starts as normal. Let it run for approximately an hour to collect data. When enough data is collected, power estimation figures will be displayed in the first column of the output table. Note Note that powertop --calibrate can only be used on laptops. 16.2.3. Setting the measuring interval By default, PowerTOP takes measurements in 20 seconds intervals. If you want to change this measuring frequency, use the following procedure: Procedure Run the powertop command with the --time option: 16.2.4. Additional resources For more details on how to use PowerTOP , see the powertop man page on your system 16.3. PowerTOP statistics While it runs, PowerTOP gathers statistics from the system. PowerTOP 's output provides multiple tabs: Overview Idle stats Frequency stats Device stats Tunables WakeUp You can use the Tab and Shift+Tab keys to cycle through these tabs. 16.3.1. The Overview tab In the Overview tab, you can view a list of the components that either send wakeups to the CPU most frequently or consume the most power. The items within the Overview tab, including processes, interrupts, devices, and other resources, are sorted according to their utilization. The adjacent columns within the Overview tab provide the following pieces of information: Usage Power estimation of how the resource is being used. Events/s Wakeups per second. The number of wakeups per second indicates how efficiently the services or the devices and drivers of the kernel are performing. Less wakeups means that less power is consumed. Components are ordered by how much further their power usage can be optimized. Category Classification of the component; such as process, device, or timer. Description Description of the component. If properly calibrated, a power consumption estimation for every listed item in the first column is shown as well. Apart from this, the Overview tab includes the line with summary statistics such as: Total power consumption Remaining battery life (only if applicable) Summary of total wakeups per second, GPU operations per second, and virtual file system operations per second 16.3.2. The Idle stats tab The Idle stats tab shows usage of C-states for all processors and cores, while the Frequency stats tab shows usage of P-states including the Turbo mode, if applicable, for all processors and cores. The duration of C- or P-states is an indication of how well the CPU usage has been optimized. The longer the CPU stays in the higher C- or P-states (for example C4 is higher than C3), the better the CPU usage optimization is. Ideally, residency is 90% or more in the highest C- or P-state when the system is idle. 16.3.3. The Device stats tab The Device stats tab provides similar information to the Overview tab but only for devices. 16.3.4. The Tunables tab The Tunables tab contains PowerTOP 's suggestions for optimizing the system for lower power consumption. Use the up and down keys to move through suggestions, and the enter key to toggle the suggestion on or off. 16.3.5. The WakeUp tab The WakeUp tab displays the device wakeup settings available for users to change as and when required. Use the up and down keys to move through the available settings, and the enter key to enable or disable a setting. Figure 16.1. PowerTOP output Additional resources For more details on PowerTOP , see PowerTOP's home page . 16.4. Why Powertop does not display Frequency stats values in some instances While using the Intel P-State driver, PowerTOP only displays values in the Frequency Stats tab if the driver is in passive mode. But, even in this case, the values may be incomplete. In total, there are three possible modes of the Intel P-State driver: Active mode with Hardware P-States (HWP) Active mode without HWP Passive mode Switching to the ACPI CPUfreq driver results in complete information being displayed by PowerTOP. However, it is recommended to keep your system on the default settings. To see what driver is loaded and in what mode, run: intel_pstate is returned if the Intel P-State driver is loaded and in active mode. intel_cpufreq is returned if the Intel P-State driver is loaded and in passive mode. acpi-cpufreq is returned if the ACPI CPUfreq driver is loaded. While using the Intel P-State driver, add the following argument to the kernel boot command line to force the driver to run in passive mode: To disable the Intel P-State driver and use, instead, the ACPI CPUfreq driver, add the following argument to the kernel boot command line: 16.5. Generating an HTML output Apart from the powertop's output in terminal, you can also generate an HTML report. Procedure Run the powertop command with the --html option: Replace the htmlfile.html parameter with the required name for the output file. 16.6. Optimizing power consumption To optimize power consumption, you can use either the powertop service or the powertop2tuned utility. 16.6.1. Optimizing power consumption using the powertop service You can use the powertop service to automatically enable all PowerTOP 's suggestions from the Tunables tab on the boot: Procedure Enable the powertop service: 16.6.2. The powertop2tuned utility The powertop2tuned utility allows you to create custom TuneD profiles from PowerTOP suggestions. By default, powertop2tuned creates profiles in the /etc/tuned/ directory, and bases the custom profile on the currently selected TuneD profile. For safety reasons, all PowerTOP tunings are initially disabled in the new profile. To enable the tunings, you can: Uncomment them in the /etc/tuned/profile_name/tuned.conf file . Use the --enable or -e option to generate a new profile that enables most of the tunings suggested by PowerTOP . Certain potentially problematic tunings, such as the USB autosuspend, are disabled by default and need to be uncommented manually. 16.6.3. Optimizing power consumption using the powertop2tuned utility Prerequisites The powertop2tuned utility is installed on the system: Procedure Create a custom profile: Activate the new profile: Additional information For a complete list of options that powertop2tuned supports, use: 16.6.4. Comparison of powertop.service and powertop2tuned Optimizing power consumption with powertop2tuned is preferred over powertop.service for the following reasons: The powertop2tuned utility represents integration of PowerTOP into TuneD , which enables to benefit of advantages of both tools. The powertop2tuned utility allows for fine-grained control of enabled tuning. With powertop2tuned , potentially dangerous tuning are not automatically enabled. With powertop2tuned , rollback is possible without reboot.

Commands:
yum install powertop
powertop
powertop --calibrate
powertop --time= time in seconds
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
intel_pstate=passive
intel_pstate=disable
powertop --html=htmlfile.html
systemctl enable powertop
yum install tuned-utils
powertop2tuned new_profile_name
tuned-adm profile new_profile_name
powertop2tuned --help