我正在使用perf工具对我的一个项目进行基准测试。我面临的问题是,当我在我的机器上运行perf tool时,一切都运行得很好。然而,我试图在自动化服务器中运行perf,使其成为我签入过程的一部分,但我从自动化服务器得到以下错误
WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
check /proc/sys/kernel/kptr_restrict.
Samples in kernel functions may not be resolved if a suitable vmlinux
file is not found in the buildid cache or in the vmlinux path.
Samples in kernel modules won't be resolved at all.
If some relocation was applied (e.g. kexec) symbols may be misresolved
even with a suitable vmlinux or kallsyms file.
Error:
Permission error - are you root?
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
fp: Terminated我尝试将/proc/sys/kernel/perf_event_paranoid更改为-1和0,但仍然看到相同的问题。有人见过这个吗?为什么我需要以root用户身份运行该命令?我可以在我的机器上运行它,而不需要sudo。
顺便说一下,该命令如下所示:
perf record -m 32 -F 99 -p xxxx -a -g --call-graph fp
发布于 2017-08-19 10:13:53
不能使用来自非根用户http://man7.org/linux/man-pages/man1/perf-record.1.html的-a (完整系统分析)和示例内核
尝试在没有-a选项的情况下运行它,并通过:u后缀将事件限制为用户空间事件:
perf record -m 32 -F 99 -p $PID -g --call-graph fp -e cycles:u或者将软件事件用于无PMU直通的虚拟化平台
perf record -m 32 -F 99 -p $PID -g --call-graph fp -e cpu-clock:uhttps://stackoverflow.com/questions/45314949
复制相似问题