Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf annotate: Pass hist_entry to annotate functions

It's a prepartion to support code annotation and data type
annotation at the same time. Data type annotation needs more
information in the hist_entry so it needs to be passed deeper.

Also rename a function with the same name in the builtin-annotate.c
to hist_entry__stdio_annotate since it matches better to the command
line option. And change the condition inside to be simpler.

Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250310224925.799005-5-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

+16 -14
+5 -5
tools/perf/builtin-annotate.c
··· 321 321 return 0; 322 322 } 323 323 324 - static int hist_entry__tty_annotate(struct hist_entry *he, 324 + static int hist_entry__stdio_annotate(struct hist_entry *he, 325 325 struct evsel *evsel, 326 326 struct perf_annotate *ann) 327 327 { 328 - if (!ann->use_stdio2) 329 - return symbol__tty_annotate(&he->ms, evsel); 328 + if (ann->use_stdio2) 329 + return hist_entry__tty_annotate2(he, evsel); 330 330 331 - return symbol__tty_annotate2(&he->ms, evsel); 331 + return hist_entry__tty_annotate(he, evsel); 332 332 } 333 333 334 334 static void print_annotate_data_stat(struct annotated_data_stat *s) ··· 541 541 if (next != NULL) 542 542 nd = next; 543 543 } else { 544 - hist_entry__tty_annotate(he, evsel, ann); 544 + hist_entry__stdio_annotate(he, evsel, ann); 545 545 nd = rb_next(nd); 546 546 } 547 547 }
+1 -1
tools/perf/builtin-top.c
··· 263 263 printf("Showing %s for %s\n", evsel__name(top->sym_evsel), symbol->name); 264 264 printf(" Events Pcnt (>=%d%%)\n", annotate_opts.min_pcnt); 265 265 266 - more = symbol__annotate_printf(&he->ms, top->sym_evsel); 266 + more = hist_entry__annotate_printf(he, top->sym_evsel); 267 267 268 268 if (top->evlist->enabled) { 269 269 if (top->zero)
+7 -4
tools/perf/util/annotate.c
··· 1174 1174 return 0; 1175 1175 } 1176 1176 1177 - int symbol__annotate_printf(struct map_symbol *ms, struct evsel *evsel) 1177 + int hist_entry__annotate_printf(struct hist_entry *he, struct evsel *evsel) 1178 1178 { 1179 + struct map_symbol *ms = &he->ms; 1179 1180 struct map *map = ms->map; 1180 1181 struct symbol *sym = ms->sym; 1181 1182 struct dso *dso = map__dso(map); ··· 1601 1600 annotation__calc_lines(notes, ms, root); 1602 1601 } 1603 1602 1604 - int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel) 1603 + int hist_entry__tty_annotate2(struct hist_entry *he, struct evsel *evsel) 1605 1604 { 1605 + struct map_symbol *ms = &he->ms; 1606 1606 struct dso *dso = map__dso(ms->map); 1607 1607 struct symbol *sym = ms->sym; 1608 1608 struct rb_root source_line = RB_ROOT; ··· 1637 1635 return 0; 1638 1636 } 1639 1637 1640 - int symbol__tty_annotate(struct map_symbol *ms, struct evsel *evsel) 1638 + int hist_entry__tty_annotate(struct hist_entry *he, struct evsel *evsel) 1641 1639 { 1640 + struct map_symbol *ms = &he->ms; 1642 1641 struct dso *dso = map__dso(ms->map); 1643 1642 struct symbol *sym = ms->sym; 1644 1643 struct rb_root source_line = RB_ROOT; ··· 1663 1660 print_summary(&source_line, dso__long_name(dso)); 1664 1661 } 1665 1662 1666 - symbol__annotate_printf(ms, evsel); 1663 + hist_entry__annotate_printf(he, evsel); 1667 1664 1668 1665 annotated_source__purge(symbol__annotation(sym)->src); 1669 1666
+3 -4
tools/perf/util/annotate.h
··· 456 456 457 457 int symbol__strerror_disassemble(struct map_symbol *ms, int errnum, char *buf, size_t buflen); 458 458 459 - int symbol__annotate_printf(struct map_symbol *ms, struct evsel *evsel); 460 459 void symbol__annotate_zero_histogram(struct symbol *sym, struct evsel *evsel); 461 460 void symbol__annotate_decay_histogram(struct symbol *sym, struct evsel *evsel); 462 461 void annotated_source__purge(struct annotated_source *as); ··· 464 465 465 466 bool ui__has_annotation(void); 466 467 467 - int symbol__tty_annotate(struct map_symbol *ms, struct evsel *evsel); 468 - 469 - int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel); 468 + int hist_entry__annotate_printf(struct hist_entry *he, struct evsel *evsel); 469 + int hist_entry__tty_annotate(struct hist_entry *he, struct evsel *evsel); 470 + int hist_entry__tty_annotate2(struct hist_entry *he, struct evsel *evsel); 470 471 471 472 #ifdef HAVE_SLANG_SUPPORT 472 473 int symbol__tui_annotate(struct map_symbol *ms, struct evsel *evsel,