Site Tools




Place to collect pieces around a pmda-denki, the public domain metrics agent (PMDA) for power. I wrote 2 blog articles which give an overview, article #1, article #2.

German video "Einfluss von Software auf den Ressourcenverbrauch (bub2018) — Jens Gröger" from the “Bits und Bäume 2018” conference. Also this talk (german) shows that the same work is sometimes done by various pieces of software with very different energy consumption.

  • Informations one would want as metrics?
    • How much overall energy is my system consuming?
    • How much are the single internal components consuming?
    • How much energy are single processes consuming? This would look at overall consumption, compute which percentage of that the process consumes, and then compute what power the process consumes.
  • How to compute overall system consumption?
    • For some systems that might be readable via IPMI or proprietary kernel modules, not sure.
    • The system itself displays consumption, i.e. as 'energy rate' in output of 'upower -d', but the value seems unusable when AC power is connected?
    • One can monitor discharge rate of the battery of a system if no AC power is attached (upower -d).
    • One could use an external power meter. The one I have can not be read digitally, so one has to run the system for some time and then read the consumption from the power meter display.
    • One could consider the whole computer as a system, and that the used electrical power is converted into thermal power. So if one has a sensor reading from the air coming into the system, and the air going out, one might be able to guess. Fan speed influences this. One could also consider the ThermalDesignPower of the CPU to verify if the computed consumption makes sense. Training sessions with/without AC power connected? With/without workloads?


dnf -y install pcp-zeroconf pcp-pmda-denki
cd /usr/libexec/pcp/pmdas/denki
pminfo -fF denki

Further implementations

  • AMD
    • older Family15h chips this is a value exported via the sensors interface that's the estimated TDP (thermal design power)
    • newer (fam15h Excavator and later) support RAPL, details, linux driver in 5.11?
  • Improvement ideas:
    • new providers, i.e. nvidia cards - depends on nvidia libs though (proprietary?)
    • power_now readings are very flaky, compute in pmda-denki an average to flatten the readings. Maybe go down to 10 readings/second? How often is the firmware/driver writing power_now?
    • Make a more solid detection of batteries, like 'upower' is doing. Current code does not detect all batteries.
    • Use intel gpu tools for reading Intel GPU consumption. “dnf install -y igt-gpu-tools; intel_gpu_top -l -s 10000”. Displayed consumption values seem to match RAPL package/uncore(gpu) quite nicely, so maybe nothing gained here from using this as source.
    • Raspi4: outputs 0.0 values for energy_now_raw/energy_now_rate/power_now. Reporting N/A might be cleaner.
    • In KVM guests like a rhel9.2, we do not get RAPL, but /dev/cpu/*/msr. We could try to use that..
  • Test series
    • Compare power consumption (and how CPU vs. GPU consumption changes) with firefox web rendering. link1 link2
    • Do the efficiency comparison (i.e. for bzip2 deencrypt) on Android mobile
    • Calculate how much longer you need to use an Applesilicon system to compensate it's higher price for lower consumption

The RAPL domains

  • psys: If existing, covers the entire SoC instead of just a CPU package. Unlike package domain, PSys support requires more than just processor level implementation. The other parts in the system need additional HW level signaling, which OEMs need to support. When not supported, the energy counter register in PSys domain returns 0.
  • cores: cpu cores
  • ram: memory
  • pkg: covers cpu + ram + gpu?
  • gpu: gpu

Power down hints

  • toggle off monitor from sway - but that still uses quite some power, i.e. my status bar
  • systemctl set-default
  • export TERM=linux; setterm --blank force
  • If you are logged in via ssh and can not do direct input, i.e. steam deck: setterm --blank force <>/dev/tty1
  • absolute minimum consumption:
    • Macbook pro M2 Asahi Fedora remix: 6W smartplug metered, denki.bat.energy_now_rate 4W, denki.bat.power_now 5W
    • Thinkpad L480: 3W smartplug metered

pmda-denki is not focusing on saving power itself, more on measuring as the first step. For saving power:

software/performance_co-pilot/pmda-denki.txt · Last modified: 2024/05/10 11:29 by chris