性能报告显示 CPU 寄存器的值
perf-report show value of CPU register
我关注 this document 并使用 perf record
和 --intr-regs=ax,bx,r15
,试图用 PEBS 记录记录额外的 CPU 注册信息。
但是我如何从 perf.data 查看这些信息?原来的command是perf report
,只显示了overhead,command,shared object,symbol等几个字段
有什么方法可以显示 CPU regs 的值吗?
我想办法用perf report -D
实现了,然后一条条记录找到你需要记录的寄存器名(不过这样好像效率很低..)
或者其他人可以提供更简化的方法?
使用 iregs
字段尝试 perf script
数据转储命令:perf script -F ip,sym,iregs
。所有字段 -F
都记录在 tools/perf/builtin-script.c - struct output_option .. all_output_options
, and iregs
is still here (also OPT_CALLBACK('F', "fields" ...
in same file). There is also perf-script.txt documentation - 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
#
我关注 this document 并使用 perf record
和 --intr-regs=ax,bx,r15
,试图用 PEBS 记录记录额外的 CPU 注册信息。
但是我如何从 perf.data 查看这些信息?原来的command是perf report
,只显示了overhead,command,shared object,symbol等几个字段
有什么方法可以显示 CPU regs 的值吗?
我想办法用perf report -D
实现了,然后一条条记录找到你需要记录的寄存器名(不过这样好像效率很低..)
或者其他人可以提供更简化的方法?
使用 iregs
字段尝试 perf script
数据转储命令:perf script -F ip,sym,iregs
。所有字段 -F
都记录在 tools/perf/builtin-script.c - struct output_option .. all_output_options
, and iregs
is still here (also OPT_CALLBACK('F', "fields" ...
in same file). There is also perf-script.txt documentation - 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 #