我遵循this document并使用perf record
和--intr-regs=ax,bx,r15
,尝试记录附加CPU寄存器信息与PEBS记录。perf-report显示CPU寄存器的值
但是,如何从perf.data中查看这些信息?原始命令是perf report
,它只显示一些字段,如开销,命令,共享对象和符号。
有什么方法可以显示CPU regs的值吗?
我遵循this document并使用perf record
和--intr-regs=ax,bx,r15
,尝试记录附加CPU寄存器信息与PEBS记录。perf-report显示CPU寄存器的值
但是,如何从perf.data中查看这些信息?原始命令是perf report
,它只显示一些字段,如开销,命令,共享对象和符号。
有什么方法可以显示CPU regs的值吗?
尝试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" ...
)。也有法律约束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-REG的” & 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
拉PERF /芯改进和修正从阿纳尔卡瓦略德梅洛: - 添加以指定选择哪个寄存器进行记录, 能力降低的perf.data文件大小,并且还允许印刷 在“PERF的脚本”寄存器:(斯特凡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 #
我找到了一种方法来实现它,通过使用perf report -D
,然后找到您需要记录的记录(但这似乎是非常低效的)寄存器的名称。
或其他人可以提供更简化的方法?
还有'PERF script'打印perf.data文件程序后处理(和它也是“pport”'-D'“完整转储选项。 perf mem的文件是perf-mem.txt,而不是perf-record.txt:https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/perf-mem.txt,这是要与'perf mem report'一起使用,而不是'perf perf report':“”perf mem report“会显示结果,它会使用正确的选项集调用perf报告以显示内存访问配置文件。 – osgx
是的,抱歉,这是一个错字。我实际上想使用'perf record'而不是'perf mem record',并且我已经解决了我的问题:) –