perf metric: Fix metric_leader
Ian Rogers
reviewerPATCH 1/1 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.
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/metricgroup.c +1 -1
@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,*/ metric_id =evsel__metric_id (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]; } }
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
Em Fri, Jan 14, 2022 at 10:28:52PM -0800, Ian Rogers escreveu:
Quoted 7 lines
Multiple events may have a
metric_leaderto aggregate into. This happens for uncore events where, for example,uncore_imcis expanded intouncore_imc_0,uncore_imc_1, etc. Such events all have the samemetric_idand should aggregate into the first event. The change introducingmetric_idshad a bug where themetric_idwas compared to itself, creating an always true condition. Correct this by comparing the event in themetric_evlistand themetric_leader.
Thanks, applied.
- Arnaldo
Quoted 21 lines
Fixes ec5c5b3d2c21 ("perf metric: Encode and use metric-id as qualifier")Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/metricgroup.c +1
-1@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,*/ metric_id =evsel__metric_id (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]; } }Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
Signature · 1 line
- Arnaldo
Quoted 11 lines · Ian Rogers
Multiple events may have a
metric_leaderto aggregate into. This happens for uncore events where, for example,uncore_imcis expanded intouncore_imc_0,uncore_imc_1, etc. Such events all have the samemetric_idand should aggregate into the first event. The change introducingmetric_idshad a bug where themetric_idwas compared to itself, creating an always true condition. Correct this by comparing the event in themetric_evlistand themetric_leader.Fixes ec5c5b3d2c21 ("perf metric: Encode and use metric-id as qualifier")Signed-off-by Ian Rogers<[email protected]>---
Looks ok and I quickly tested it: