Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RAPL plugin

The RAPL plugin creates an Alumet source that collects measurements of processor energy usage via RAPL interfaces, such as perf-events and powercap.

Requirements

Metrics

Here are the metrics collected by the plugin source.

NameTypeUnitDescriptionAttributesMore information
rapl_consumed_energyCounter DiffjouleEnergy consumed since the previous measurementdomain

Attributes

Domain

A domain is a specific area of power consumption tracked by RAPL. The possible domain values are:

ValueDescription
platformthe entire machine - ⚠️ may vary depending on the model
packagethe CPU cores, the iGPU, the L3 cache and the controllers
pp0the CPU cores
pp1the iGPU
dramthe RAM attached to the processor

Configuration

Here is a configuration example of the RAPL plugin. It's part of the Alumet configuration file (eg: alumet-config.toml).

[plugins.rapl]
# Interval between two RAPL measurements.
poll_interval = "1s"
# Interval between two flushing of RAPL measurements.
flush_interval = "5s"
# Set to true to disable perf-events and always use the powercap sysfs.
no_perf_events = false

More information

Should I use perf-events or powercap ?

Both interfaces provide similar energy consumption data, but we recommend using perf-events for lower measurement overhead (especially in high-frequency polling scenarios).

For a more detailed technical comparison, see this publication on RAPL measurement methods.

perf_event_paranoid and capabilities

You should read this section in case you're using perf-events to collect measurements.

perf_event_paranoid is a Linux kernel setting that controls the level of access that unprivileged (non-root) users have to access features provided by the perf subsystem which can be used in this plugin (should I use perf-events or powercap).

Below is a summary of how different perf_event_paranoid values affect RAPL plugin functionality when running as an unprivileged user:

perf_event_paranoid valueDescriptionRequired capabilities (binary)RAPL plugin works (unprivileged)
4 (Debian-based systems only)Disables all perf event usage for unprivileged users❌ Not supported
2Allows only user-space measurementscap_perfmon (or cap_sys_admin for Linux < 5.8)✅ Supported
1Allows user-space and kernel-space measurementscap_perfmon (or cap_sys_admin for Linux < 5.8)✅ Supported
0Allows user-space, kernel-space, and CPU-specific datacap_perfmon (or cap_sys_admin for Linux < 5.8)✅ Supported
-1Full access, including raw tracepoints✅ Supported

Example for setting perf_event_paranoid: sudo sysctl -w kernel.perf_event_paranoid=2 will set the value to 2.

Note that this command will not make it permanent (reset after restart).

Alternatively, you can run Alumet as a privileged user (root), but this is not recommended for security reasons.