我关注this document并将perf record
与--intr-regs=ax,bx,r15
一起使用,尝试使用PEBS记录记录其他CPU注册信息。
但是如何从perf.data查看这些信息?原始命令是perf report
,它只显示一些字段,如开销,命令,共享对象和符号。
有没有办法显示CPU regs的值?
答案 0 :(得分:2)
使用perf script
字段iregs
尝试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('我','intr-regs',& record.opts.sample_intr_regs,NULL,“任何寄存器”,
然后在提交中搜索“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
从Arnaldo Carvalho de Melo获取穿孔/核心改进和修复: - 添加指定选择要记录的寄存器的功能, 减少perf.data文件的大小,也允许打印 '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 #
答案 1 :(得分:0)
我找到了一种方法来使用overflow: hidden
来实现它,然后找到寄存器'按记录记录所需的名称(但这似乎效率很低......)。
或者其他人可以提供更简化的方法?