PowerLetrics is an open-source framework designed to monitor and analyze power consumption metrics at the process level on Linux. Similar to how top
displays memory or CPU time, PowerLetrics provides the "Energy Footprint" of each process in real-time. This project is still in the early stages of development. Please test it and submit any issues.
This project is heavily influenced by the powermetrics
program on macOS.
https://github.com/iovisor/bcc/blob/master/INSTALL.md
You can then install the program with pip install powerletrics
. Please note that if you are using a venv
you will need to create it with --system-site-packages
as otherwise we don't have access to the bcc libs
If you want to use RAPL and PSYS data you need to build the binaries. You will need gcc
and make
on your system.
PowerLetrics will try and build everything on the first run for you.
You can then run the program from the shell:
powerletrics -i 1000 --show-all
There is also the option to get the CPU energy from RAPL. You can activate this with --rapl
.
If your computer support it you can also get the PSYS energy with --psys
.
We don't enable this by default as we want to make the program runnable in a VM so people can test it easily and we want the default to work in all environments.
If you want to use this feature you will need to install gcc
on your machine and build the tools with make
-i
/ --sample-rate
-n
/ --sample-count
-o
/ --output-file
-r
/ --order
pid
, wakeups
, cputime
, composite
composite
pid
: Sort by process ID.wakeups
: Sort by the number of CPU wakeups.cputime
: Sort by CPU time.composite
: Sort by the composite energy impact (a weighted combination of several factors, like CPU, memory, and disk usage).--show-all
--show-process-io
--show-process-netstats
--show-command-line
--format
text
, plist
text
text
: Human-readable text format.plist
: Property list (XML) format, useful for programmatic analysis.--proc-memory
--flush
--server
--port
--host
--rapl
--psys
--rapl-sample-rate
When calculating the energy impact each value is multiplied with a weight
these are different for each machine. You
can modify them in the config.conf
or /etc/powerletrics
file.
Execute this before starting the program
tput rmam
Because we use Total Virtual Memory
instead of Resident Set Size
Only programs that have run are listed as they are the only ones that have actually used something.
Because it does the same things (yes we check) and is slower as it adds more overhead. We still π psutil though.