gpt4 book ai didi

Linux perf 工具运行问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:38:46 25 4
gpt4 key购买 nike

我正在使用 perf 工具对我的一个项目进行基准测试。我面临的问题是我在我的机器上运行 perf 工具时无法获得自动化,一切正常。但是,我试图在自动化服务器中运行 perf 以使其成为我 checkin 过程的一部分,但我从自动化服务器中收到以下错误

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

最佳答案

您不能使用 -a(完整的系统分析)和来自非根用户的示例内核:http://man7.org/linux/man-pages/man1/perf-record.1.html

尝试在没有 -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:u

关于Linux perf 工具运行问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45314949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com