• Arnaldo Carvalho de Melo's avatar
    perf annotate: Allow setting the offset level in .perfconfig · 43c40231
    Arnaldo Carvalho de Melo authored
    The default is 1 (jump_target):
    
      # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave
      Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574
      _raw_spin_lock_irqsave() /proc/kcore
        0.26        nop
        4.61        push   %rbx
       19.33        pushfq
        7.97        pop    %rax
        0.32        nop
        0.06        mov    %rax,%rbx
       14.63        cli
        0.06        nop
                    xor    %eax,%eax
                    mov    $0x1,%edx
       49.94        lock   cmpxchg %edx,(%rdi)
        0.16        test   %eax,%eax
                  ↓ jne    2b
        2.66        mov    %rbx,%rax
                    pop    %rbx
                  ← retq
              2b:   mov    %eax,%esi
                  → callq  *ffffffffb30eaed0
                    mov    %rbx,%rax
                    pop    %rbx
                  ← retq
      #
    
    But one can ask for showing offsets for call instructions by setting
    this:
    
      # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave
      Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574
      _raw_spin_lock_irqsave() /proc/kcore
        0.26        nop
        4.61        push   %rbx
       19.33        pushfq
        7.97        pop    %rax
        0.32        nop
        0.06        mov    %rax,%rbx
       14.63        cli
        0.06        nop
                    xor    %eax,%eax
                    mov    $0x1,%edx
       49.94        lock   cmpxchg %edx,(%rdi)
        0.16        test   %eax,%eax
                  ↓ jne    2b
        2.66        mov    %rbx,%rax
                    pop    %rbx
                  ← retq
              2b:   mov    %eax,%esi
              2d: → callq  *ffffffffb30eaed0
                    mov    %rbx,%rax
                    pop    %rbx
                  ← retq
      #
    
    Or using a big value to ask for all offsets to be shown:
    
      # cat ~/.perfconfig
      [annotate]
    
    	offset_level = 100
    
    	hide_src_code = true
      # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave
      Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574
      _raw_spin_lock_irqsave() /proc/kcore
        0.26   0:   nop
        4.61   5:   push   %rbx
       19.33   6:   pushfq
        7.97   7:   pop    %rax
        0.32   8:   nop
        0.06   d:   mov    %rax,%rbx
       14.63  10:   cli
        0.06  11:   nop
              17:   xor    %eax,%eax
              19:   mov    $0x1,%edx
       49.94  1e:   lock   cmpxchg %edx,(%rdi)
        0.16  22:   test   %eax,%eax
              24: ↓ jne    2b
        2.66  26:   mov    %rbx,%rax
              29:   pop    %rbx
              2a: ← retq
              2b:   mov    %eax,%esi
              2d: → callq  *ffffffffb30eaed0
              32:   mov    %rbx,%rax
              35:   pop    %rbx
              36: ← retq
       #
    
    This also affects the TUI, i.e. the default 'perf annotate' and 'perf
    top/report' -> A hotkey -> annotate interfaces, when slang-devel is present
    in the build, i.e.:
    
      # perf version --build-options | grep slang
                  libslang: [ on  ]  # HAVE_SLANG_SUPPORT
      #
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Martin Liška <mliska@suse.cz>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-venm6x5zrt40eu8hxdsmqxz6@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    43c40231
annotate.c 65.4 KB