We have a CentOS 7 system with two user accounts:
- Sally, to run production jobs.
- Tanya, for monitoring and interactive jobs.
Sally runs a specific job that Tanya needs to monitor using
perf top. Tanya tried running
perf top -p PID, but it exits with an 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
-1, but the same error occurred.
Sally is willing to enable monitoring of all of her processes by Tanya. Enabling just this one PID would be OK too (e.g. Sally could run a script every time after starting her process to enable monitoring by Tanya...if only they knew what to write in that script).
If we were discussing GDB, it seems the answer would be
sudo. Is there any way to use
perf to monitor Sally's jobs without becoming Sally? Sally and Tanya trust each other, but would rather not use impersonation unless absolutely necessary.