Em Wed, Oct 11, 2023 at 08:50:45PM -0700, Namhyung Kim escreveu: > The --type-stat option is to be used with --data-type and to print > detailed failure reasons for the data type annotation. > > $ perf annotate --data-type --type-stat > Annotate data type stats: > total 294, ok 116 (39.5%), bad 178 (60.5%) > ----------------------------------------------------------- > 30 : no_sym > 40 : no_insn_ops > 33 : no_mem_ops > 63 : no_var > 4 : no_typeinfo > 8 : bad_offset Had to enclose it as well, as: ⬢[acme@toolbox perf-tools-next]$ grep annotate-data tools/perf/util/Build perf-$(CONFIG_DWARF) += annotate-data.o ⬢[acme@toolbox perf-tools-next]$ /usr/bin/ld: /tmp/build/perf-tools-next/perf-in.o: in function `cmd_annotate': (.text+0x27b7): undefined reference to `ann_data_stat' /usr/bin/ld: (.text+0x27bd): undefined reference to `ann_data_stat' /usr/bin/ld: (.text+0x27c4): undefined reference to `ann_data_stat' /usr/bin/ld: (.text+0x27cb): undefined reference to `ann_data_stat' /usr/bin/ld: (.text+0x27d2): undefined reference to `ann_data_stat' /usr/bin/ld: /tmp/build/perf-tools-next/perf-in.o:(.text+0x27d9): more undefined references to `ann_data_stat' follow collect2: error: ld returned 1 exit status make[2]: *** [Makefile.perf:675: /tmp/build/perf-tools-next/perf] Error 1 When building with NO_DWARF=1 or in systems lacking the used DWARF libraries. I noticed with some of the build containers, will updated those to have the required libraries so that this feature gets compile tested there. diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 645acaba63f1957a..5b534245ddb23294 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -353,6 +353,7 @@ static void print_annotated_data_type(struct annotated_data_type *mem_type, printf(";\n"); } +#ifdef HAVE_DWARF_SUPPORT static void print_annotate_data_stat(struct annotated_data_stat *s) { #define PRINT_STAT(fld) if (s->fld) printf("%10d : %s\n", s->fld, #fld) @@ -389,6 +390,7 @@ static void print_annotate_data_stat(struct annotated_data_stat *s) #undef PRINT_STAT } +#endif // HAVE_DWARF_SUPPORT static void hists__find_annotations(struct hists *hists, struct evsel *evsel, @@ -396,10 +398,10 @@ static void hists__find_annotations(struct hists *hists, { struct rb_node *nd = rb_first_cached(&hists->entries), *next; int key = K_RIGHT; - +#ifdef HAVE_DWARF_SUPPORT if (ann->type_stat) print_annotate_data_stat(&ann_data_stat); - +#endif while (nd) { struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); struct annotation *notes; @@ -698,8 +700,10 @@ int cmd_annotate(int argc, const char **argv) itrace_parse_synth_opts), OPT_BOOLEAN(0, "data-type", &annotate.data_type, "Show data type annotate for the memory accesses"), +#ifdef HAVE_DWARF_SUPPORT OPT_BOOLEAN(0, "type-stat", &annotate.type_stat, "Show stats for the data type annotation"), +#endif OPT_END() }; int ret;
![]() |