• Arnaldo Carvalho de Melo's avatar
    perf annotate browser: Add 'P' hotkey to dump annotation to file · d9bd7665
    Arnaldo Carvalho de Melo authored
    Just like we have in the histograms browser used as the main screen for
    'perf top --tui' and 'perf report --tui', to print the current
    annotation to a file with a named composed by the symbol name and the
    ".annotation" suffix.
    
    Here is one example of pressing 'A' on 'perf top' to live annotate a
    kernel function and then press 'P' to dump that annotation, the
    resulting file:
    
      # cat _raw_spin_lock_irqsave.annotation
      _raw_spin_lock_irqsave() /proc/kcore
      Event: cycles:ppp
    
        7.14        nop
       21.43        push   %rbx
        7.14        pushfq
                    pop    %rax
                    nop
                    mov    %rax,%rbx
                    cli
                    nop
                    xor    %eax,%eax
                    mov    $0x1,%edx
       64.29        lock   cmpxchg %edx,(%rdi)
                    test   %eax,%eax
                  ↓ jne    2b
                    mov    %rbx,%rax
                    pop    %rbx
                  ← retq
              2b:   mov    %eax,%esi
                  → callq  queued_spin_lock_slowpath
                    mov    %rbx,%rax
                    pop    %rbx
                  ← retq
      #
    
    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: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-zzmnrwugb5vtk7bvg0rbx150@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d9bd7665
annotate.h 8.6 KB