Commit d3e2bb43 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf metric: Fix metric_leader

Multiple events may have a metric_leader to aggregate into.

This happens for uncore events where, for example, uncore_imc is
expanded into uncore_imc_0, uncore_imc_1, etc.

Such events all have the same metric_id and should aggregate into the
first event.

The change introducing metric_ids had a bug where the metric_id was
compared to itself, creating an always true condition.

Correct this by comparing the event in the metric_evlist and the
metric_leader.

Fixes: ec5c5b3d ("perf metric: Encode and use metric-id as qualifier")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20220115062852.1959424-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a6e62743
...@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids, ...@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,
*/ */
metric_id = evsel__metric_id(ev); metric_id = evsel__metric_id(ev);
evlist__for_each_entry_continue(metric_evlist, ev) { evlist__for_each_entry_continue(metric_evlist, ev) {
if (!strcmp(evsel__metric_id(metric_events[i]), metric_id)) if (!strcmp(evsel__metric_id(ev), metric_id))
ev->metric_leader = metric_events[i]; ev->metric_leader = metric_events[i];
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment