| Crates.io | rapl-energy |
| lib.rs | rapl-energy |
| version | 0.1.24 |
| created_at | 2024-06-21 08:58:14.921836+00 |
| updated_at | 2025-08-26 08:12:33.257981+00 |
| description | Small library for getting the CPU energy consumption from RAPL |
| homepage | |
| repository | https://github.com/JordyAaldering/rapl-energy |
| max_upload_size | |
| id | 1279272 |
| size | 66,965 |
Reading CPU energy consumption and controlling CPU power limits through RAPL.
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