• K
    perf script: Add 'brstackinsnlen' for branch stacks · 6f680c6a
    Kan Liang 提交于
    When analyzing with 'perf script', it's useful to understand the
    captured instruction and the next sequential instruction.
    
    To calculate the address of the next sequential instruction, the length
    of the captured instruction is required.
    
    For example, you can’t know the next sequential instruction after an
    unconditional branch unless you calculate that based on its length.
    
    For branch stacks, 'perf script' only prints the instruction bytes with
    'brstackinsn', but lacks the instruction length.
    
    Add 'brstackinsnlen' to print the instruction length.
    
      $ perf script -F ip,brstackinsn,brstackinsnlen --xed
         7fa555be8f75
            _start:
            00007fa555be8090    mov %rsp, %rdi              ilen: 3
            00007fa555be8093    callq  0x7fa555be8ea0       ilen: 5 # PRED 102 cycles [102] 0.02 IPC
            _dl_start+38:
            00007fa555be8ec6    movq  %rdx,0x227853(%rip)   ilen: 7
            00007fa555be8ecd    leaq  0x227f94(%rip),%rdx   ilen: 7
    Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
    Cc: Ahmad Yasin <ahmad.yasin@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
    Link: https://lore.kernel.org/r/1647871212-184070-1-git-send-email-kan.liang@linux.intel.com
    [ Added the new field to tools/perf/Documentation/perf-script.txt ]
    Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    6f680c6a
perf-script.txt 17.6 KB