climate

total_consumption_hardware.png

Power consumption on Linux, measurements

In the previous article I talked about external meters and pmda-denki. Now lets see how much power certain hardware components need. Pmda-denki usage pmda-denki is now in PCP upstream. One can use the code from there, via packages build regularly, or wait for the next PCP release to make it into the Linux distros. With that done, and pmda-denki being installed, metrics regarding electrical power are available. On laptops where pmda-denki can access both sources: As per ‘pmrep .
denki_black_on_yellow4b.jpg

An approach to get power consumption metrics right on Linux

TL’DR With a Linux laptop, you can quite accurately measure the systems current overall power consumption while on battery. This allows to compare if the new version of your software uses more power than the old one. On Intel/AMD systems, power consumption of cpu’s can be measured with RAPL - good enough to compare cpu workloads. You can read these metrics directly from sysfs and do some simple computations, or