]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf annotate: Set notes->src->nr_events early
authorNamhyung Kim <namhyung@kernel.org>
Sat, 3 Aug 2024 21:13:29 +0000 (14:13 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 5 Aug 2024 19:11:03 +0000 (16:11 -0300)
We want to use it in different places so make sure it sets properly
in symbol__annotate() before creating the disasm lines.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.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/20240803211332.1107222-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c

index 91ad948c89d5b0bd1d80e13f8ead6c6492182869..09e6fdf344db810055d40ca6fadc8073028b4a29 100644 (file)
@@ -925,6 +925,11 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
                        return -1;
        }
 
+       if (evsel__is_group_event(evsel))
+               notes->src->nr_events = evsel->core.nr_members;
+       else
+               notes->src->nr_events = 1;
+
        if (annotate_opts.full_addr)
                notes->src->start = map__objdump_2mem(ms->map, ms->sym->start);
        else
@@ -1842,10 +1847,7 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel,
        struct symbol *sym = ms->sym;
        struct annotation *notes = symbol__annotation(sym);
        size_t size = symbol__size(sym);
-       int nr_pcnt = 1, err;
-
-       if (evsel__is_group_event(evsel))
-               nr_pcnt = evsel->core.nr_members;
+       int err;
 
        err = symbol__annotate(ms, evsel, parch);
        if (err)
@@ -1861,8 +1863,6 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel,
                return err;
 
        annotation__init_column_widths(notes, sym);
-       notes->src->nr_events = nr_pcnt;
-
        annotation__update_column_widths(notes);
        sym->annotate2 = 1;