• Arnaldo Carvalho de Melo's avatar
    perf annotate browser: Show extra title line with event information · 6920e285
    Arnaldo Carvalho de Melo authored
    So at the top we'll have two lines, like this, from 'perf report':
    
      # perf report --group --ignore-vmlinux
    =====================================================================================================
    Samples: 46  of events 'cycles', 4000 Hz, Event count (approx.): 5154895
    _raw_spin_lock_irqsave  /proc/kcore
    Percent              │      nop
                         │      push   %rbx
      0.00  14.29   0.00 │      pushfq
      9.09   0.00   0.00 │      pop    %rax
      9.09   0.00  20.00 │      nop
                         │      mov    %rax,%rbx
                         │      cli
      4.55   7.14   0.00 │      nop
                         │      xor    %eax,%eax
                         │      mov    $0x1,%edx
                         │      lock   cmpxchg %edx,(%rdi)
     77.27  78.57  70.00 │      test   %eax,%eax
                         │    ↓ jne    2b
                         │      mov    %rbx,%rax
      0.00   0.00  10.00 │      pop    %rbx
                         │    ← retq
                         │2b:   mov    %eax,%esi
                         │    → callq  queued_spin_lock_slowpath
                         │      mov    %rbx,%rax
                         │      pop    %rbx
    Press 'h' for help on│key bindings
    =====================================================================================================
    
     9.09 + 9.09 + 4.55 + 77.27 = 100
    14.29 + 7.14 + 78.57 = 100
    20 + 70 + 10 = 100
    
    We can do the math by using 't' to toggle from 'percent' to nr
    
    =====================================================================================================
    Samples: 46  of events 'cycles', 4000 Hz, Event count (approx.): 5154895
    _raw_spin_lock_irqsave  /proc/kcore
    Period                              │      nop
                                        │      push   %rbx
              0       79273           0 │      pushfq
         190455           0           0 │      pop    %rax
         198038           0        3045 │      nop
                                        │      mov    %rax,%rbx
                                        │      cli
         217233       32562           0 │      nop
                                        │      xor    %eax,%eax
                                        │      mov    $0x1,%edx
                                        │      lock   cmpxchg %edx,(%rdi)
        3421649      979174       28273 │      test   %eax,%eax
                                        │    ↓ jne    2b
                                        │      mov    %rbx,%rax
              0           0        5193 │      pop    %rbx
                                        │    ← retq
                                        │2b:   mov    %eax,%esi
                                        │    → callq  queued_spin_lock_slowpath
                                        │      mov    %rbx,%rax
                                        │      pop    %rbx
    Press 'h' for help on│key bindings
    =====================================================================================================
    
    79273 + 190455 + 198038 + 3045 + 217233 + 32562 + 3421649 + 979174 + 28273 + 5193 = 5154895
    
    Or number of samples:
    
    =====================================================================================================
    ooSamples: 46  of events 'cycles', 4000 Hz, Event count (approx.): 5154895
    _raw_spin_lock_irqsave  /proc/kcore
    Samples              │      nop
                         │      push   %rbx
         0      2      0 │      pushfq
         2      0      0 │      pop    %rax
         2      0      2 │      nop
                         │      mov    %rax,%rbx
                         │      cli
         1      1      0 │      nop
                         │      xor    %eax,%eax
                         │      mov    $0x1,%edx
                         │      lock   cmpxchg %edx,(%rdi)
        17     11      7 │      test   %eax,%eax
                         │    ↓ jne    2b
                         │      mov    %rbx,%rax
         0      0      1 │      pop    %rbx
                         │    ← retq
                         │2b:   mov    %eax,%esi
                         │    → callq  queued_spin_lock_slowpath
                         │      mov    %rbx,%rax
                         │      pop    %rbx
    Press 'h' for help on key bindings
    =====================================================================================================
    
    2 + 2 + 2 + 2 + 1 + 1 + 17 + 11 + 7 + 1 = 46
    Suggested-by: default avatarMartin Liška <mliska@suse.cz>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196935
    Link: https://lkml.kernel.org/n/tip-ezccyxld50wtwyt66np6aomo@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    6920e285
annotate.c 23.3 KB