#energy-consumption #benchmarking #sustainability

rapl-energy

Small library for getting the CPU energy consumption from RAPL

29 releases

Uses new Rust 2024

new 0.2.2 Jun 3, 2026
0.2.1 Mar 20, 2026
0.1.25 Feb 20, 2026
0.1.24 Aug 26, 2025
0.1.9 Jul 24, 2024

#214 in Profiling

Download history 68/week @ 2026-02-10 73/week @ 2026-02-17 8/week @ 2026-02-24 5/week @ 2026-03-17 9/week @ 2026-03-24 39/week @ 2026-05-19 92/week @ 2026-05-26

131 downloads per month
Used in 3 crates (2 directly)

GPL-3.0 license

24KB
382 lines

RAPL Energy

Reading CPU energy consumption and controlling CPU power limits through RAPL.

Reading RAPL requires elevated permissions.

RAPL permissions

  • Create a new rapl group.
sudo groupadd rapl
sudo usermod -aG rapl $USER
  • Create a new file sudo nano /etc/udev/rules.d/70-intel-rapl.rules and add the following rule.
ACTION=="add", SUBSYSTEM=="powercap", KERNEL=="intel-rapl:*", \
  RUN+="/usr/bin/chgrp rapl /sys/%p/energy_uj", \
  RUN+="/usr/bin/chmod g+r /sys/%p/energy_uj"

Reboot, and check if you can read cat /sys/class/powercap/intel-rapl:*/energy_uj

Dependencies

~0.6–1.4MB
~26K SLoC