gpt4 book ai didi

linux - 性能报告显示 CPU 寄存器的值

转载 作者:太空狗 更新时间:2023-10-29 12:11:23 24 4
gpt4 key购买 nike

我关注 this document并使用 perf record--intr-regs=ax,bx,r15,尝试使用 PEBS 记录记录额外的 CPU 寄存器信息。

但是我如何从 perf.data 中查看这些信息?原来的命令是perf report,只显示开销、命令、共享对象和符号等几个字段。

有什么方法可以显示 CPU regs 的值吗?

最佳答案

使用 iregs 字段尝试 perf script 数据转储命令:perf script -F ip,sym,iregs。所有字段 -F 都用 tools/perf/builtin-script.c - struct output_option .. all_output_options 的源代码记录,并且 iregs 仍然在这里(还有 OPT_CALLBACK('F', "fields"... 在同一文件中)。还有 perf-script.txt 文档 - https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/perf-script.txt#L115

-F::
--fields::
Comma separated list of fields to print. Options are:
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff,
srcline, period, iregs, brstack, brstacksym, flags, bpf-output, brstackinsn,
callindent, insn, insnlen. Field list can be prepended with the type, trace, sw or hw,
to indicate to which event type the field list applies.

Linux 内核 git 的提交中提到了标记 --intr-regs。从选项实现开始:

https://github.com/torvalds/linux/search?utf8=%E2%9C%93&q=intr-regs&type=

tools/perf/builtin-record.c OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register",

然后在提交中搜索“sample_intr_regs”:https://github.com/torvalds/linux/search?q=sample_intr_regs&type=Commits

几个提交是关于内核部分和 perf_attr 调试打印。但这有 intr-regs 打印的例子(2015 年 9 月 1 日) https://github.com/torvalds/linux/commit/532026612455a4a6fd27c1b2e7111263f63218a2

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: - Add ability to specify to select which registers to record, to reduce the size of perf.data files, and also allow printing the registers in 'perf script': (Stephane Eranian)

  # perf record --intr-regs=AX,SP usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data (8 samples) ]
# perf script -F ip,sym,iregs | tail -5
ffffffff8105f42a native_write_msr_safe AX:0xf SP:0xffff8802629c3c00
ffffffff8105f42a native_write_msr_safe AX:0xf SP:0xffff8802629c3c00
ffffffff81761ac0 _raw_spin_lock AX:0xffff8801bfcf8020 SP:0xffff8802629c3ce8
ffffffff81202bf8 __vma_adjust_trans_huge AX:0x7ffc75200000 SP:0xffff8802629c3b30
ffffffff8122b089 dput AX:0x101 SP:0xffff8802629c3c78
#

关于linux - 性能报告显示 CPU 寄存器的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44163079/

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