25 releases
Uses new Rust 2024
| 0.1.24 | Aug 26, 2025 |
|---|---|
| 0.1.23 | Apr 2, 2025 |
| 0.1.19 | Nov 22, 2024 |
| 0.1.15 | Oct 22, 2024 |
| 0.1.2 | Jun 26, 2024 |
#271 in Profiling
1,086 downloads per month
Used in energy-bench
23KB
299 lines
RAPL Energy
Reading CPU energy consumption and controlling CPU power limits through RAPL.
RAPL permissions
Reading RAPL requires elevated permissions.
I suggest adding a new rapl group.
sudo addgroup rapl
sudo usermod -aG rapl $(whoami)
And then adding entries to /etc/sysfs.conf for your RAPL domains and subdomains.
Check your folder hierarchy in /sys/class/powercap/ to determine which domains
you have available to your CPU.
Then for each domain, add the following lines to /etc/sysfs.conf.
(Requires sysfsutils to be installed.)
For example, for package 0:
mode class/powercap/intel-rapl:0/energy_uj = 0440
owner class/powercap/intel-rapl:0/energy_uj = root:rapl
And for its first subdomain:
mode class/powercap/intel-rapl:0:0/energy_uj = 0440
owner class/powercap/intel-rapl:0:0/energy_uj = root:rapl
Finally, restart the sysfsutils service.
sudo systemctl restart sysfsutils
Dependencies
~0.7–2MB
~39K SLoC