Skip to main content
Last updated March 26, 2012 14:29, by mikeb2701
Feedicon  

Running PCM Counters as an Unprivileged User on Linux

To make the PCM counters work on Linux the user running the code needs to read/write access to the /dev/cpu/*/msr files. A nice way to do this is using unix groups.

First create a new group to give msr privileges too:

sudo groupadd msr

Add the user that needs to run the PCM code to that group:

sudo usermod -G -a msr someuser

Set the permissions on the msr device files to allow that users to read and write (you may need to put this in a script to run at start up if it needs to be persistent).

sudo chgrp msr /dev/cpu/*/msr
sudo chmod 0660 /dev/cpu/*/msr

 
 
Close
loading
Please Confirm
Close