Skip to content

Latest commit

 

History

History

msr

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

MSR Energy Monitor

This implementation of the energymon interface reads Package-level energy data from Intel Model Specific Registers on Linux platforms. It supports CPUs that implement the standard Running Average Power Limit (RAPL) interface, as described in the Intel Software Developer"s Manual, Volume 3A.

Use the raplcap-msr implementation for broader Intel CPU support, automatic detection of multi-package and multi-die systems, and support for other power domains.

Prerequisites

First, you must be using a system that supports Intel MSRs.

The implementation first checks for the msr-safe kernel module, otherwise it falls back on the msr kernel module.

To load the msr kernel module:

sudo modprobe msr

Privileges

Typically, sudo/root privileges are needed to read from MSR device files which are located at /dev/cpu/*/msr. Instead of launching an application that uses this interface with root privileges, a user may be able to chmod the msr file(s) to world-readable, e.g.:

sudo chmod og+r /dev/cpu/0/msr

On some Linux kernels you may still get an Operation not permitted error. Set RAWIO permissions on your executable:

sudo setcap cap_sys_rawio+ep BINARY

If using the msr-safe module, ensure that your user has read privileges to the msr_safe file(s), like above, and that the following registers have read permissions enabled:

  • MSR_RAPL_POWER_UNIT
  • MSR_PKG_ENERGY_STATUS

You can add them to the whitelist by running from this directory:

sudo sh -c "cat etc/msr_safe_whitelist >> /dev/cpu/msr_whitelist"

Usage

By default, only the MSR for cpu 0 will be accessed. To override this behavior, you can configure the MSRs to access by setting the ENERGYMON_MSRS environment variable with a comma-delimited list of CPUs to read from, e.g.:

export ENERGYMON_MSRS=0,4,8,12