[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-80ee8c588afde077cb0439e15129579a267916c4@git.kernel.org>
Date: Wed, 25 Apr 2018 22:57:51 -0700
From: tip-bot for Kan Liang <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: zhangshaokun@...ilicon.com, tglx@...utronix.de,
namhyung@...nel.org, ganapatrao.kulkarni@...ium.com, hpa@...or.com,
jolsa@...hat.com, ak@...ux.intel.com, acme@...hat.com,
peterz@...radead.org, will.deacon@....com, yao.jin@...ux.intel.com,
mingo@...nel.org, kan.liang@...ux.intel.com,
linux-kernel@...r.kernel.org, agustinv@...eaurora.org
Subject: [tip:perf/urgent] perf stat: Fix duplicate PMU name for interval
print
Commit-ID: 80ee8c588afde077cb0439e15129579a267916c4
Gitweb: https://git.kernel.org/tip/80ee8c588afde077cb0439e15129579a267916c4
Author: Kan Liang <kan.liang@...ux.intel.com>
AuthorDate: Tue, 24 Apr 2018 11:20:14 -0700
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 24 Apr 2018 16:12:00 -0300
perf stat: Fix duplicate PMU name for interval print
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.
Committer notes:
Add and use perf_evsel->uniquified_name bool instead of doing the more
expensive strstr(event->name, pmu->name).
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Agustin Vega-Frias <agustinv@...eaurora.org>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@...ium.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Shaokun Zhang <zhangshaokun@...ilicon.com>
Cc: Will Deacon <will.deacon@....com>
Fixes: 8c5421c016a4 ("perf pmu: Display pmu name when printing unmerged events in stat")
Link: http://lkml.kernel.org/r/1524594014-79243-5-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-stat.c | 5 ++++-
tools/perf/util/evsel.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 30e6b374e095..f17dc601b0f3 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1284,7 +1284,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
char *new_name;
char *config;
- if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
+ if (counter->uniquified_name ||
+ !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
strlen(counter->pmu_name)))
return;
@@ -1302,6 +1303,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
counter->name = new_name;
}
}
+
+ counter->uniquified_name = true;
}
static void collect_all_aliases(struct perf_evsel *counter,
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index d3ee3af618ef..92ec009a292d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -115,6 +115,7 @@ struct perf_evsel {
unsigned int sample_size;
int id_pos;
int is_pos;
+ bool uniquified_name;
bool snapshot;
bool supported;
bool needs_swap;
Powered by blists - more mailing lists