Function find_evsel_group() seems broken for aliases covering multiple
PMUs, as dicussed at:

https://lore.kernel.org/lkml/CAP-5=fuy6fosznrwjf6znpqqssyrnlpv6gbkeczmqahup3x...@mail.gmail.com/

For now, hack a fix which I only know works for me.

Signed-off-by: John Garry <john.ga...@huawei.com>
---
 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

Reply via email to