Re: [PATCH v2 3/4] perf tools: Add support for displaying weights in annotate
Namhyung Kim <[email protected]>
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
Hi Andi, On Thu, Aug 13, 2026 at 02:10:09PM -0700, Andi Kleen wrote: > Add support for showing all the three possible per IP weights in > annotate. The weights are shown by defaults if any are non zero. This > is useful, especially with the new insn lat statistics, but also > for all the existing weights. > > Add a hotkey to the interactive browser to turn them off (w), as well > as a perf annotate command line option. > > The weights are stored unconditionally in the sym_hist_entry, which > will increase memory consumption somewhat. > > Assisted-by: omp:GPT-5.6-Luna > Signed-off-by: Andi Kleen <[email protected]> > --- > tools/perf/Documentation/perf-annotate.txt | 3 + > tools/perf/builtin-annotate.c | 3 + > tools/perf/builtin-report.c | 1 + > tools/perf/ui/browsers/annotate.c | 17 ++- > tools/perf/util/annotate.c | 117 ++++++++++++++++++--- > tools/perf/util/annotate.h | 32 +++++- > tools/perf/util/symbol.c | 1 + > tools/perf/util/symbol_conf.h | 17 ++- > 8 files changed, 170 insertions(+), 21 deletions(-) > > diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt > index a688738809c4..50c6ea680d0d 100644 > --- a/tools/perf/Documentation/perf-annotate.txt > +++ b/tools/perf/Documentation/perf-annotate.txt > @@ -79,6 +79,9 @@ include::itrace.txt[] > > --stdio:: Use the stdio interface. > > +--no-weights:: Hide weight columns in annotation output. By default, weight columns > + are shown when samples contain non-zero weights. > + > --stdio2:: Use the stdio2 interface, non-interactive, uses the TUI formatting. > > --stdio-color=<mode>:: > diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c > index 69cb72b2082a..c6c481145e45 100644 > --- a/tools/perf/builtin-annotate.c > +++ b/tools/perf/builtin-annotate.c > @@ -259,6 +259,7 @@ static int add_sample(struct perf_sample *sample, > return 0; > } > > + > /* > * XXX filtered samples can still have branch entries pointing into our > * symbol and are missed. > @@ -719,6 +720,8 @@ int cmd_annotate(int argc, const char **argv) > OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"), > #endif > OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"), > + OPT_BOOLEAN(0, "no-weights", &symbol_conf.hide_weight, > + "Hide weight columns in annotation"), Can it be just "weights"? Then we would get --no-weights for free. :) Of course, the help message needs to say differently. Thanks, Namhyung > OPT_BOOLEAN(0, "stdio2", &annotate.use_stdio2, "Use the stdio interface"), > OPT_BOOLEAN(0, "ignore-vmlinux", &symbol_conf.ignore_vmlinux, > "don't load vmlinux even if found"),