[PATCH RFC v4 09/13] perf metricgroup: Hack a fix for aliases when covering multiple PMUs
From: John Garry
Date: Thu Oct 08 2020 - 06:19:34 EST
Function find_evsel_group() seems broken for aliases covering multiple
PMUs, as dicussed at:
https://lore.kernel.org/lkml/CAP-5=fUy6FOszNRwJF6ZNpqQSSyrnLPV6GbkEcZMqAhUp3X0ZA@xxxxxxxxxxxxxx/
For now, hack a fix which I only know works for me.
Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
---
tools/perf/util/metricgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index d948a7f910cf..82ba3638f48c 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -213,7 +213,7 @@ static struct evsel *find_evsel_group(struct evlist *perf_evlist,
/* Ignore event if already used and merging is disabled. */
if (metric_no_merge && test_bit(ev->idx, evlist_used))
continue;
- if (!has_constraint && ev->leader != current_leader) {
+ if (!has_constraint && (!current_leader || strcmp(current_leader->name, ev->leader->name))) {
/*
* Start of a new group, discard the whole match and
* start again.
@@ -279,7 +279,7 @@ static struct evsel *find_evsel_group(struct evlist *perf_evlist,
* when then group is left.
*/
if (!has_constraint &&
- ev->leader != metric_events[i]->leader)
+ strcmp(ev->leader->name, metric_events[i]->leader->name))
break;
if (!strcmp(metric_events[i]->name, ev->name)) {
set_bit(ev->idx, evlist_used);
--
2.26.2