perf-report显示CPU寄存器的值 [英] perf-report show value of CPU register

查看:132
本文介绍了perf-report显示CPU寄存器的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循此文档,然后将perf record--intr-regs=ax,bx,r15结合使用,尝试将其他CPU寄存器信息记录到PEBS记录中.

I follow this document and using perf record with --intr-regs=ax,bx,r15, trying to log additional CPU register information with PEBS record.

但是我如何从perf.data查看那些信息?原始命令为perf report,并且仅显示一些字段,例如开销,命令,共享对象和符号.

But how do I view those info from perf.data? The original command is perf report, and it only shows a few fields such as overhead, command, shared object and symbol.

有什么办法可以显示CPU reg的值?

Is there any way to show CPU regs' value?

推荐答案

使用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文档-

Try perf script data dumping command with the iregs field: perf script -F ip,sym,iregs. All fields -F are documented with source code of 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.从选项实施开始:


There were commits into linux kernel git which mention flag --intr-regs. Start from option implementation:

> 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,任何寄存器",

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

Then search for 'sample_intr_regs' in commits: 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

Several commits were about kernel part and perf_attr debug print. But this has example of intr-regs printing (Sep 1, 2015) https://github.com/torvalds/linux/commit/532026612455a4a6fd27c1b2e7111263f63218a2

从Arnaldo Carvalho de Melo获得的性能/核心方面的改进和修复: -添加了指定指定要记录的寄存器的功能, 减少perf.data文件的大小,并允许打印 "perf脚本"中的寄存器:(史蒂芬·埃兰)

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
  #

这篇关于perf-report显示CPU寄存器的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆