[PATCHSET 0/5] perf annotate: Add --skip-empty option (v1)

Namhyung Kim posted 5 patches 1 year, 4 months ago
tools/perf/Documentation/perf-annotate.txt |  3 ++
tools/perf/builtin-annotate.c              |  2 +
tools/perf/util/annotate.c                 | 47 +++++++++++++---------
tools/perf/util/annotate.h                 |  2 +-
tools/perf/util/disasm.c                   |  6 +--
5 files changed, 35 insertions(+), 25 deletions(-)
[PATCHSET 0/5] perf annotate: Add --skip-empty option (v1)
Posted by Namhyung Kim 1 year, 4 months ago
Hello,

This is to make perf annotate has the same behavior as perf report.
Especially in the TUI browser, we want to maintain the same experience
when it comes to display dummy events from perf report.

  $ perf mem record -a -- perf test -w noploop

  $ perf evlist
  cpu/mem-loads,ldlat=30/P
  cpu/mem-stores/P
  dummy:u

Just using perf annotate with --group will show the all 3 events.

  $ perf annotate --group --stdio | head
   Percent                 |    Source code & Disassembly of ...
  --------------------------------------------------------------
                           : 0     0xe060 <_dl_relocate_object>:
      0.00    0.00    0.00 :    e060:       pushq   %rbp
      0.00    0.00    0.00 :    e061:       movq    %rsp, %rbp
      0.00    0.00    0.00 :    e064:       pushq   %r15
      0.00    0.00    0.00 :    e066:       movq    %rdi, %r15
      0.00    0.00    0.00 :    e069:       pushq   %r14
      0.00    0.00    0.00 :    e06b:       pushq   %r13
      0.00    0.00    0.00 :    e06d:       movl    %edx, %r13d

Now with --skip-empty, it'll hide the last dummy event.

  $ perf annotate --group --stdio --skip-empty | head
   Percent         |    Source code & Disassembly of ...
  ------------------------------------------------------
                   : 0     0xe060 <_dl_relocate_object>:
      0.00    0.00 :    e060:       pushq   %rbp
      0.00    0.00 :    e061:       movq    %rsp, %rbp
      0.00    0.00 :    e064:       pushq   %r15
      0.00    0.00 :    e066:       movq    %rdi, %r15
      0.00    0.00 :    e069:       pushq   %r14
      0.00    0.00 :    e06b:       pushq   %r13
      0.00    0.00 :    e06d:       movl    %edx, %r13d

The code is available in 'perf/annotate-skip-v1' branch at
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung


Namhyung Kim (5):
  perf annotate: Use al->data_nr if possible
  perf annotate: Set notes->src->nr_events early
  perf annotate: Use annotation__pcnt_width() consistently
  perf annotate: Set al->data_nr using the notes->src->nr_events
  perf annotate: Add --skip-empty option

 tools/perf/Documentation/perf-annotate.txt |  3 ++
 tools/perf/builtin-annotate.c              |  2 +
 tools/perf/util/annotate.c                 | 47 +++++++++++++---------
 tools/perf/util/annotate.h                 |  2 +-
 tools/perf/util/disasm.c                   |  6 +--
 5 files changed, 35 insertions(+), 25 deletions(-)

-- 
2.46.0.rc2.264.g509ed76dc8-goog
Re: [PATCHSET 0/5] perf annotate: Add --skip-empty option (v1)
Posted by Arnaldo Carvalho de Melo 1 year, 4 months ago
On Sat, Aug 03, 2024 at 02:13:27PM -0700, Namhyung Kim wrote:
> Hello,
> 
> This is to make perf annotate has the same behavior as perf report.
> Especially in the TUI browser, we want to maintain the same experience
> when it comes to display dummy events from perf report.
> 
>   $ perf mem record -a -- perf test -w noploop
> 
>   $ perf evlist
>   cpu/mem-loads,ldlat=30/P
>   cpu/mem-stores/P
>   dummy:u

Thanks, tested and applied to tmp.perf-tools-next will go to
perf-tools-next later.

- Arnaldo
 
> Just using perf annotate with --group will show the all 3 events.
> 
>   $ perf annotate --group --stdio | head
>    Percent                 |    Source code & Disassembly of ...
>   --------------------------------------------------------------
>                            : 0     0xe060 <_dl_relocate_object>:
>       0.00    0.00    0.00 :    e060:       pushq   %rbp
>       0.00    0.00    0.00 :    e061:       movq    %rsp, %rbp
>       0.00    0.00    0.00 :    e064:       pushq   %r15
>       0.00    0.00    0.00 :    e066:       movq    %rdi, %r15
>       0.00    0.00    0.00 :    e069:       pushq   %r14
>       0.00    0.00    0.00 :    e06b:       pushq   %r13
>       0.00    0.00    0.00 :    e06d:       movl    %edx, %r13d
> 
> Now with --skip-empty, it'll hide the last dummy event.
> 
>   $ perf annotate --group --stdio --skip-empty | head
>    Percent         |    Source code & Disassembly of ...
>   ------------------------------------------------------
>                    : 0     0xe060 <_dl_relocate_object>:
>       0.00    0.00 :    e060:       pushq   %rbp
>       0.00    0.00 :    e061:       movq    %rsp, %rbp
>       0.00    0.00 :    e064:       pushq   %r15
>       0.00    0.00 :    e066:       movq    %rdi, %r15
>       0.00    0.00 :    e069:       pushq   %r14
>       0.00    0.00 :    e06b:       pushq   %r13
>       0.00    0.00 :    e06d:       movl    %edx, %r13d
> 
> The code is available in 'perf/annotate-skip-v1' branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> Thanks,
> Namhyung
> 
> 
> Namhyung Kim (5):
>   perf annotate: Use al->data_nr if possible
>   perf annotate: Set notes->src->nr_events early
>   perf annotate: Use annotation__pcnt_width() consistently
>   perf annotate: Set al->data_nr using the notes->src->nr_events
>   perf annotate: Add --skip-empty option
> 
>  tools/perf/Documentation/perf-annotate.txt |  3 ++
>  tools/perf/builtin-annotate.c              |  2 +
>  tools/perf/util/annotate.c                 | 47 +++++++++++++---------
>  tools/perf/util/annotate.h                 |  2 +-
>  tools/perf/util/disasm.c                   |  6 +--
>  5 files changed, 35 insertions(+), 25 deletions(-)
> 
> -- 
> 2.46.0.rc2.264.g509ed76dc8-goog
>