Skip to main content
This revision made March 23, 2012 20:05, by mikeb2701

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 -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

Difference compared to previous revision
<span><pre>sudo groupadd msr</pre> Add the user that needs to run the PCM code to that group: <pre>sudo usermod -<span style="text-decoration:line-through;color:red">C</span><span style="text-decoration:underline;color:green">a</span> msr someuser</pre> 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). <pre>sudo chgrp msr /dev/cpu/*/msr</pre><span>
 
 
Close
loading
Please Confirm
Close