LKML Archive on
 help / color / Atom feed
From: tip-bot for Andi Kleen <>
Subject: [tip:perf/core] perf stat: Don't merge events in the same PMU
Date: Wed, 3 Jul 2019 07:28:32 -0700
Message-ID: <> (raw)
In-Reply-To: <>

Commit-ID:  6c5f4e5cb35b4694dc035d91092d23f596ecd06a
Author:     Andi Kleen <>
AuthorDate: Mon, 24 Jun 2019 12:37:09 -0700
Committer:  Arnaldo Carvalho de Melo <>
CommitDate: Mon, 1 Jul 2019 22:50:41 -0300

perf stat: Don't merge events in the same PMU

Event merging is mainly to collapse similar events in lots of different
duplicated PMUs.

It can break metric displaying. It's possible for two metrics to have
the same event, and when the two events happen in a row the second
wouldn't be displayed.  This would also not show the second metric.

To avoid this don't merge events in the same PMU. This makes sense, if
we have multiple events in the same PMU there is likely some reason for
it (e.g. using multiple groups) and we better not merge them.

While in theory it would be possible to construct metrics that have
events with the same name in different PMU no current metrics have this

This is the fix for perf stat -M UPI,IPC (needs also another bug fix to
completely work)

Signed-off-by: Andi Kleen <>
Acked-by: Jiri Olsa <>
Cc: Kan Liang <>
Fixes: 430daf2dc7af ("perf stat: Collapse identically named events")
Signed-off-by: Arnaldo Carvalho de Melo <>
 tools/perf/util/stat-display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 90df41169113..58df6a0dbb9f 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -554,7 +554,8 @@ static void collect_all_aliases(struct perf_stat_config *config, struct perf_evs
 		    alias->scale != counter->scale ||
 		    alias->cgrp != counter->cgrp ||
 		    strcmp(alias->unit, counter->unit) ||
-		    perf_evsel__is_clock(alias) != perf_evsel__is_clock(counter))
+		    perf_evsel__is_clock(alias) != perf_evsel__is_clock(counter) ||
+		    !strcmp(alias->pmu_name, counter->pmu_name))
 		alias->merged_stat = true;
 		cb(config, alias, data, false);

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 19:37 Some bug fixes for perf stat metrics Andi Kleen
2019-06-24 19:37 ` [PATCH v1 1/4] perf stat: Make metric event lookup more robust Andi Kleen
2019-07-03 14:27   ` [tip:perf/core] " tip-bot for Andi Kleen
2019-06-24 19:37 ` [PATCH v1 2/4] perf stat: Don't merge events in the same PMU Andi Kleen
2019-07-03 14:28   ` tip-bot for Andi Kleen [this message]
2019-06-24 19:37 ` [PATCH v1 3/4] perf stat: Fix group lookup for metric group Andi Kleen
2019-07-03 14:29   ` [tip:perf/core] " tip-bot for Andi Kleen
2019-06-24 19:37 ` [PATCH v1 4/4] perf stat: Fix metrics with --no-merge Andi Kleen
2019-07-03 14:29   ` [tip:perf/core] " tip-bot for Andi Kleen
2019-06-25  9:23 ` Some bug fixes for perf stat metrics Jiri Olsa
2019-06-26 18:43   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone