Skip to content

Commit d3e2bb4

Browse files
captain5050acmel
authored andcommitted
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: ec5c5b3 ("perf metric: Encode and use metric-id as qualifier") Signed-off-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a6e6274 commit d3e2bb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/metricgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,
314314
*/
315315
metric_id = evsel__metric_id(ev);
316316
evlist__for_each_entry_continue(metric_evlist, ev) {
317-
if (!strcmp(evsel__metric_id(metric_events[i]), metric_id))
317+
if (!strcmp(evsel__metric_id(ev), metric_id))
318318
ev->metric_leader = metric_events[i];
319319
}
320320
}

0 commit comments

Comments
 (0)