30
15
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
Error:
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.
Does
– osgx – 2018-05-25T03:54:43.707perf stat -e cycles:u
work? "3" value ofperf_event_paranoid
was added in 2016 https://lwn.net/Articles/696216/ "Disallowing perf_event_open()" and was enabled in "Android and Debian" (also https://lkml.org/lkml/2016/1/11/587 https://bugs.launchpad.net/bugs/1612790 https://www.debian.org/security/2017/dsa-3791)1@osgx: For me with paranoid level 3 your suggestion does not work, I am still not allowed to use it. – Martin Ueding – 2019-05-15T12:00:20.827