[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1524594014-79243-5-git-send-email-kan.liang@linux.intel.com>
Date: Tue, 24 Apr 2018 11:20:14 -0700
From: kan.liang@...ux.intel.com
To: acme@...nel.org, mingo@...hat.com, peterz@...radead.org,
linux-kernel@...r.kernel.org
Cc: jolsa@...hat.com, namhyung@...nel.org,
ganapatrao.kulkarni@...ium.com, zhangshaokun@...ilicon.com,
yao.jin@...ux.intel.com, will.deacon@....com, ak@...ux.intel.com,
agustinv@...eaurora.org, Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH 5/5] perf stat: Fix duplicate PMU name for interval print
From: Kan Liang <kan.liang@...ux.intel.com>
PMU name is printed repeatedly for interval print, for example:
perf stat --no-merge -e 'unc_m_clockticks' -a -I 1000
# time counts unit events
1.001053069 243,702,144 unc_m_clockticks [uncore_imc_4]
1.001053069 244,268,304 unc_m_clockticks [uncore_imc_2]
1.001053069 244,427,386 unc_m_clockticks [uncore_imc_0]
1.001053069 244,583,760 unc_m_clockticks [uncore_imc_5]
1.001053069 244,738,971 unc_m_clockticks [uncore_imc_3]
1.001053069 244,880,309 unc_m_clockticks [uncore_imc_1]
2.002024821 240,818,200 unc_m_clockticks [uncore_imc_4]
[uncore_imc_4]
2.002024821 240,767,812 unc_m_clockticks [uncore_imc_2]
[uncore_imc_2]
2.002024821 240,764,215 unc_m_clockticks [uncore_imc_0]
[uncore_imc_0]
2.002024821 240,759,504 unc_m_clockticks [uncore_imc_5]
[uncore_imc_5]
2.002024821 240,755,992 unc_m_clockticks [uncore_imc_3]
[uncore_imc_3]
2.002024821 240,750,403 unc_m_clockticks [uncore_imc_1]
[uncore_imc_1]
For each print, the PMU name is unconditionally appended to the
counter->name.
Need to check the counter->name first. If the PMU name is already
appended, do nothing.
Fixes: 8c5421c016a4 ("perf pmu: Display pmu name when printing unmerged events in stat")
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
tools/perf/builtin-stat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 30e6b37..e22c213 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1296,6 +1296,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
counter->name = new_name;
}
} else {
+ if (strstr(counter->name, counter->pmu_name))
+ return;
if (asprintf(&new_name,
"%s [%s]", counter->name, counter->pmu_name) > 0) {
free(counter->name);
--
2.7.4
Powered by blists - more mailing lists