Pages

Tuesday, June 19, 2018

Fedora 28 : The Powertop tool from Intel.

The Powertop is a tool provided by Intel to enable various powersaving modes in userspace, kernel and hardware.
Using this tool is possible to monitor processes and show which of them are utilizing the CPU and wake it from its Idle-States.
The tool allowing you to identify applications with particular high power demands.
The name of this tool powertop.x86_64 come from : Power consumption monitor.
Let's install and set this tool to Fedora 28 distro linux:
[root@desk mythcat]# dnf install powertop.x86_64 
Last metadata expiration check: 0:32:08 ago on Tue 19 Jun 2018 10:19:39 AM EEST.
Dependencies resolved.
================================================================================
 Package           Arch            Version               Repository        Size
================================================================================
Installing:
 powertop          x86_64          2.9-8.fc28            updates          239 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 239 k
Installed size: 650 k
Is this ok [y/N]: y
Downloading Packages:
powertop-2.9-8.fc28.x86_64.rpm                  112 kB/s | 239 kB     00:02    
--------------------------------------------------------------------------------
Total                                            71 kB/s | 239 kB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : powertop-2.9-8.fc28.x86_64                             1/1 
  Running scriptlet: powertop-2.9-8.fc28.x86_64                             1/1 
  Verifying        : powertop-2.9-8.fc28.x86_64                             1/1 

Installed:
  powertop.x86_64 2.9-8.fc28                                                    

Complete!
You need root privileges to run this tool :
[mythcat@desk ~]$ powertop --calibrate --debug
PowerTOP v2.9 must be run with root privileges.
exiting...
The help output of this tool :
[root@desk mythcat]# powertop --help

Usage: powertop [OPTIONS]

     --auto-tune     sets all tunable options to their GOOD setting
 -c, --calibrate     runs powertop in calibration mode
 -C, --csv[=filename]     generate a csv report
     --debug         run in "debug" mode
     --extech[=devnode]     uses an Extech Power Analyzer for measurements
 -r, --html[=filename]     generate a html report
 -i, --iteration[=iterations] number of times to run each test
 -q, --quiet         suppress stderr output
 -s, --sample[=seconds]     interval for power consumption measurement
 -t, --time[=seconds]     generate a report for 'x' seconds
 -w, --workload[=workload] file to execute for workload
 -V, --version         print version information
 -h, --help         print this help menu

For more help please refer to the 'man 8 powertop'
To run the program and enable its background services, use the commands below:
[root@desk mythcat]# systemctl start powertop.service
[root@desk mythcat]# systemctl enable powertop.service
Created symlink /etc/systemd/system/multi-user.target.wants/powertop.service → /usr/lib/systemd/system/powertop.service.
This is my output with powertop calibrate :
[root@desk mythcat]# powertop --calibrate --debug
modprobe cpufreq_stats failedLoaded 0 prior measurements
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
Devfreq not enabled
glob returned GLOB_ABORTED
Starting PowerTOP power estimate calibration 
Calibrating idle
System is not available
System is not available
Calibrating: disk usage 
Calibrating backlight
Calibrating idle
System is not available
System is not available
Calibrating: CPU usage on 1 threads
Calibrating: CPU usage on 4 threads
Calibrating: CPU wakeup power consumption
Calibrating: CPU wakeup power consumption
Calibrating: CPU wakeup power consumption
Calibrating USB devices
.... device /sys/bus/usb/devices/2-1/power/control 
.... device /sys/bus/usb/devices/usb1/power/control 
.... device /sys/bus/usb/devices/1-1.3/power/control 
.... device /sys/bus/usb/devices/1-1/power/control 
.... device /sys/bus/usb/devices/usb2/power/control 
Calibrating radio devices
Finishing PowerTOP power estimate calibration 
Parameters after calibration:


Parameter state 
----------------------------------
Value        Name
 0.50        alsa-codec-power (12)
 0.00        backlight (4)
 0.00        backlight-boost-100 (8)
 0.00        backlight-boost-40 (6)
 0.00        backlight-boost-80 (7)
 0.00        backlight-power (5)
 2.33        base power (70)
 1.56        cpu-consumption (3)
39.50        cpu-wakeups (2)
 0.00        disk-operations (73)
 0.20        disk-operations-hard (72)
 0.00        enp2s0-link-100 (21)
 0.00        enp2s0-link-1000 (22)
 0.00        enp2s0-link-high (23)
 0.00        enp2s0-packets (24)
 0.00        enp2s0-powerunsave (20)
 0.00        enp2s0-up (19)
 0.56        gpu-operations (71)
 0.00        runtime-0000:00:00.0 (34)
 0.00        runtime-0000:00:02.0 (37)
 0.00        runtime-0000:00:16.0 (44)
 0.00        runtime-0000:00:1a.0 (35)
 0.00        runtime-0000:00:1b.0 (45)
 0.00        runtime-0000:00:1c.0 (41)
 0.00        runtime-0000:00:1c.2 (38)
 0.00        runtime-0000:00:1c.3 (31)
 0.00        runtime-0000:00:1d.0 (36)
 0.00        runtime-0000:00:1e.0 (32)
 0.00        runtime-0000:00:1f.0 (42)
 0.00        runtime-0000:00:1f.2 (39)
 0.00        runtime-0000:00:1f.3 (33)
 0.00        runtime-0000:02:00.0 (43)
 0.00        runtime-0000:03:00.0 (40)
 0.00        runtime-Fixed MDIO bus.0 (57)
 0.00        runtime-INT0800:00 (52)
 0.00        runtime-PNP0103:00 (49)
 0.00        runtime-PNP0800:00 (48)
 0.00        runtime-PNP0C04:00 (51)
 0.00        runtime-PNP0C0C:00 (58)
 0.00        runtime-alarmtimer (54)
 0.00        runtime-coretemp.0 (55)
 0.00        runtime-gpio_ich.1.auto (47)
 0.00        runtime-i2c-0 (67)
 0.00        runtime-i2c-1 (63)
 0.00        runtime-i2c-2 (66)
 0.00        runtime-i2c-3 (62)
 0.00        runtime-i2c-4 (65)
 0.00        runtime-i2c-5 (69)
 0.00        runtime-i2c-6 (64)
 0.00        runtime-i2c-7 (68)
 0.00        runtime-i8042 (60)
 0.00        runtime-iTCO_wdt.0.auto (61)
 0.00        runtime-microcode (53)
 0.00        runtime-pcspkr (56)
 0.00        runtime-platform-framebuffer.0 (50)
 0.00        runtime-reg-dummy (46)
 0.00        runtime-serial8250 (59)
 0.10        usb-device-1d6b-0002 (10)
 0.10        usb-device-248a-8366 (11)
 0.10        usb-device-8087-0024 (9)
 0.00        virbr0-link-100 (15)
 0.00        virbr0-link-1000 (16)
 0.00        virbr0-link-high (17)
 0.00        virbr0-nic-link-100 (27)
 0.00        virbr0-nic-link-1000 (28)
 0.00        virbr0-nic-link-high (29)
 0.00        virbr0-nic-packets (30)
 0.00        virbr0-nic-powerunsave (26)
 0.00        virbr0-nic-up (25)
 0.00        virbr0-packets (18)
 0.00        virbr0-powerunsave (14)
 0.00        virbr0-up (13)
 0.10        xwakes (74)

Score:    0.0  (  0.0)
Guess:    2.3
Actual:   0.0
----------------------------------
Learning debugging enabled


Parameter state 
----------------------------------
Value        Name
 0.50        alsa-codec-power (12)
 0.00        backlight (4)
 0.00        backlight-boost-100 (8)
 0.00        backlight-boost-40 (6)
 0.00        backlight-boost-80 (7)
 0.00        backlight-power (5)
 2.33        base power (70)
 1.56        cpu-consumption (3)
39.50        cpu-wakeups (2)
 0.00        disk-operations (73)
 0.20        disk-operations-hard (72)
 0.00        enp2s0-link-100 (21)
 0.00        enp2s0-link-1000 (22)
 0.00        enp2s0-link-high (23)
 0.00        enp2s0-packets (24)
 0.00        enp2s0-powerunsave (20)
 0.00        enp2s0-up (19)
 0.56        gpu-operations (71)
 0.00        runtime-0000:00:00.0 (34)
 0.00        runtime-0000:00:02.0 (37)
 0.00        runtime-0000:00:16.0 (44)
 0.00        runtime-0000:00:1a.0 (35)
 0.00        runtime-0000:00:1b.0 (45)
 0.00        runtime-0000:00:1c.0 (41)
 0.00        runtime-0000:00:1c.2 (38)
 0.00        runtime-0000:00:1c.3 (31)
 0.00        runtime-0000:00:1d.0 (36)
 0.00        runtime-0000:00:1e.0 (32)
 0.00        runtime-0000:00:1f.0 (42)
 0.00        runtime-0000:00:1f.2 (39)
 0.00        runtime-0000:00:1f.3 (33)
 0.00        runtime-0000:02:00.0 (43)
 0.00        runtime-0000:03:00.0 (40)
 0.00        runtime-Fixed MDIO bus.0 (57)
 0.00        runtime-INT0800:00 (52)
 0.00        runtime-PNP0103:00 (49)
 0.00        runtime-PNP0800:00 (48)
 0.00        runtime-PNP0C04:00 (51)
 0.00        runtime-PNP0C0C:00 (58)
 0.00        runtime-alarmtimer (54)
 0.00        runtime-coretemp.0 (55)
 0.00        runtime-gpio_ich.1.auto (47)
 0.00        runtime-i2c-0 (67)
 0.00        runtime-i2c-1 (63)
 0.00        runtime-i2c-2 (66)
 0.00        runtime-i2c-3 (62)
 0.00        runtime-i2c-4 (65)
 0.00        runtime-i2c-5 (69)
 0.00        runtime-i2c-6 (64)
 0.00        runtime-i2c-7 (68)
 0.00        runtime-i8042 (60)
 0.00        runtime-iTCO_wdt.0.auto (61)
 0.00        runtime-microcode (53)
 0.00        runtime-pcspkr (56)
 0.00        runtime-platform-framebuffer.0 (50)
 0.00        runtime-reg-dummy (46)
 0.00        runtime-serial8250 (59)
 0.10        usb-device-1d6b-0002 (10)
 0.10        usb-device-248a-8366 (11)
 0.10        usb-device-8087-0024 (9)
 0.00        virbr0-link-100 (15)
 0.00        virbr0-link-1000 (16)
 0.00        virbr0-link-high (17)
 0.00        virbr0-nic-link-100 (27)
 0.00        virbr0-nic-link-1000 (28)
 0.00        virbr0-nic-link-high (29)
 0.00        virbr0-nic-packets (30)
 0.00        virbr0-nic-powerunsave (26)
 0.00        virbr0-nic-up (25)
 0.00        virbr0-packets (18)
 0.00        virbr0-powerunsave (14)
 0.00        virbr0-up (13)
 0.10        xwakes (74)

Score:    0.0  (  0.0)
Guess:    2.3
Actual:   0.0
----------------------------------
Now we can sets all tunable options to their GOOD setting:
[root@desk mythcat]# powertop --auto-tune
modprobe cpufreq_stats failedLoaded 0 prior measurements
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
Devfreq not enabled
glob returned GLOB_ABORTED
Leaving PowerTOP