I'm running debian testing with the 4.1 kernel and version 4.1 of the perf tool. In this version they seem to have added some sort of protection to keep normal users from collecting data from that tool. So running perf as normal user will give this error:

perf stat ls
You may not have permission to collect stats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid:
 -1 - Not paranoid at all
  0 - Disallow raw tracepoint access for unpriv
  1 - Disallow cpu events for unpriv
  2 - Disallow kernel profiling for unpriv

perf_event_paranoid contains 3 in my installation. Unfortunately I can't change that file even as root. How can I allow my own user to use perf without sudo rights?

I have an application I would like to benchmark which doesn't need root and I don't want to run it as root to benchmark it.


Files in /proc that are writable are usually changed by echoing a value into them. You should try:

sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid'
  • 9
    To persist across reboots: sudo sh -c 'echo kernel.perf_event_paranoid=1 > /etc/sysctl.d/local.conf' – Márcio Mar 12 '17 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.