perf report: Do not collect sample histogram unnecessarily
authorNamhyung Kim <namhyung@kernel.org>
Thu, 11 Apr 2024 03:32:56 +0000 (20:32 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Apr 2024 15:02:06 +0000 (12:02 -0300)
The data type profiling alone doesn't need the sample histogram for
functions.  It only needs the histogram for the types.

Let's remove the condition in the report_callback to check if data type
profiling is selected and make sure the annotation has the 'struct
annotated_source' instantiated before calling symbol__disassemble().

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240411033256.2099646-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/util/annotate.c

index aaa6427a12247486d08910febf864e99e83c8c92..dafba6e030ef70b915ed5d1ad048d86a02158273 100644 (file)
@@ -172,7 +172,7 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
        struct mem_info *mi;
        struct branch_info *bi;
 
-       if (!ui__has_annotation() && !rep->symbol_ipc && !rep->data_type)
+       if (!ui__has_annotation() && !rep->symbol_ipc)
                return 0;
 
        if (sort__mode == SORT_MODE__BRANCH) {
index ec79c120a7d2f3840b21da4b1a6f634bf8e60b0e..7595c8fbc2c5e2d25ec635d39f213b899299a1bc 100644 (file)
@@ -908,6 +908,13 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
 
        args.arch = arch;
        args.ms = *ms;
+
+       if (notes->src == NULL) {
+               notes->src = annotated_source__new();
+               if (notes->src == NULL)
+                       return -1;
+       }
+
        if (annotate_opts.full_addr)
                notes->src->start = map__objdump_2mem(ms->map, ms->sym->start);
        else