Skip to content
Wrapper library for model-specific registers. APIs cover RAPL, performance counters, clocks and turbo.
C C++ CMake
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
demoapps/powmon Update license and source file notice. Aug 5, 2019
documentation Removing outdated API file. This fixes #17. See dox files for most up… Jan 10, 2017
dox Doxygen now works for out-of-source builds. Jul 5, 2018
include Update license and source file notice. Aug 5, 2019
msrmod Minor fixes to msrmod: Jun 5, 2017
patches Adding patch to fix #14. On a hyperthreaded system without the patch, Jan 10, 2017
platform_headers Update license and source file notice. Aug 5, 2019
test Update license and source file notice. Aug 5, 2019
.gitignore Parameterizing CMake build of executables in test directory to make i… Sep 7, 2017
AUTHORS Update authors, remove trailing whitespace. Aug 5, 2019
CMakeLists.txt Fix node topology mapping (fixes #30): Oct 9, 2018 Update authors, remove trailing whitespace. Aug 5, 2019
LICENSE Move notice text from LICENSE into required NOTICE file Aug 21, 2019
NOTICE Move notice text from LICENSE into required NOTICE file Aug 21, 2019
README Update authors, remove trailing whitespace. Aug 5, 2019 Small updates: Jan 25, 2017
TODO Fixing libmsr build issues on Ubuntu. Mar 24, 2017
VERSION Small clean-up. Aug 26, 2016
autoconf.c Update license and source file notice. Aug 5, 2019
changelog.txt Migrating updated libmsr code base with Doxygen documentation: Aug 23, 2016 merged Dan Ellsworth's files, updated documentation, removed restore … Sep 4, 2015


Read the Docs

Welcome to Libmsr, a friendly (well, friendlier) interface to many of the model-specific registers in Intel processors. Now with PCI configuration register support for some Intel hardware.

version 0.3.1

Last Update

2 August 2019



Libmsr provides an interface to accessing the model-specific registers (MSRs) on Intel platforms, which provide privileged functionality for monitoring and controlling various CPU features.


Installation is simple. You will need CMAKE version 2.8 or higher and GCC. In most cases, the installation is as follows:

$ cmake . -DCMAKE_INSTALL_PREFIX=${HOME}/build/libmsr
$ make
$ make install

The installation depends on a master.h file, which defines the offsets for several MSRs given a particular architecture (e.g., Sandy Bridge, Ivy Bridge, Haswell, etc.). The auto-configuration tool can be forced to use the header file of a specific architecture or can auto-detect the architecture. To specify a particular architecture, run cmake with the option -DLIBMSR_TARGET_ARCH=<ARG> where ARG is in hexadecimal. In the future, we plan to have a set of architecture-specific configuration files that can be pre-loaded to CMake to populate the cache.

Currently supported architectures are Intel Xeon v1-3 (Sandy Bridge, Ivy Bridge, and Haswell server processors). The library technically supports all processors based on these architectures, but some features may be missing from client products. Using the wrong header file is likely to cause problems.

Supported Architectures:

2D (Sandy Bridge)       57 (Knights Landing)
3E (Ivy Bridge)
3F (Haswell)
4F (Broadwell)
55 (Skylake)*

If you are unsure of your architecture number, check the "model" field in lscpu or /proc/cpuinfo (note that it will not be in hexadecimal).

*The Skylake support is currently experimental and requires more testing/validation.


This software depends on the files /dev/cpu/*/msr being present with R/W permissions. Recent kernels require additional capabilities. We have found it easier to use our own MSR-SAFE kernel module, but running as root (or going through the bother of adding the capabilities to the binaries) is another option.

If you need PCI configuration register (CSR) support in Libmsr, you MUST have CSR-SAFE installed. This code is not currently on Github -- you will need to request it.

Call msr_init() before using any of the APIs.

For sample code, see libmsr_test.c in the test/ directory.

Our most up-to-date documentation for Libmsr can be generated with make doc and make latex_doc for HTML and PDF versions, respectively. There are also some useful PDF files in the documentation/ directory.

If you wish to use Libmsr on LLNL's Cab system, you will need to apply a patch to gain MSR access. At this time, the patch will need to be requested as it is not on Github.


Barry Rountree, Project Lead,
Stephanie Brink, Developer,

Please feel free to contact the developers with any questions or feedback.

We are collecting names of those who have previously contributed to libmsr over the years. See the current list in the AUTHORS file. Please contact the developers to have your name added to the list.


libmsr is released under the GPLv2.1 license. For more details, see the LICENSE file.

You can’t perform that action at this time.