[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-bbac88ed64436201d6b6f2b00177d58081d56707@git.kernel.org>
Date: Sat, 1 Jul 2017 01:54:16 -0700
From: tip-bot for Adrian Hunter <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, adrian.hunter@...el.com, hpa@...or.com,
linux-kernel@...r.kernel.org, mingo@...nel.org, ak@...ux.intel.com,
tglx@...utronix.de
Subject: [tip:perf/core] perf intel-pt: Factor out intel_pt_set_event_name()
Commit-ID: bbac88ed64436201d6b6f2b00177d58081d56707
Gitweb: http://git.kernel.org/tip/bbac88ed64436201d6b6f2b00177d58081d56707
Author: Adrian Hunter <adrian.hunter@...el.com>
AuthorDate: Fri, 26 May 2017 11:17:32 +0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 30 Jun 2017 11:44:36 -0300
perf intel-pt: Factor out intel_pt_set_event_name()
Factor out intel_pt_set_event_name() so it can be reused.
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-32-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/intel-pt.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 81907f6..a20712e 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -1931,6 +1931,21 @@ static int intel_pt_synth_event(struct perf_session *session, const char *name,
return err;
}
+static void intel_pt_set_event_name(struct perf_evlist *evlist, u64 id,
+ const char *name)
+{
+ struct perf_evsel *evsel;
+
+ evlist__for_each_entry(evlist, evsel) {
+ if (evsel->id && evsel->id[0] == id) {
+ if (evsel->name)
+ zfree(&evsel->name);
+ evsel->name = strdup(name);
+ break;
+ }
+ }
+}
+
static struct perf_evsel *intel_pt_evsel(struct intel_pt *pt,
struct perf_evlist *evlist)
{
@@ -2015,15 +2030,8 @@ static int intel_pt_synth_events(struct intel_pt *pt,
pt->sample_transactions = true;
pt->transactions_sample_type = attr.sample_type;
pt->transactions_id = id;
+ intel_pt_set_event_name(evlist, id, "transactions");
id += 1;
- evlist__for_each_entry(evlist, evsel) {
- if (evsel->id && evsel->id[0] == pt->transactions_id) {
- if (evsel->name)
- zfree(&evsel->name);
- evsel->name = strdup("transactions");
- break;
- }
- }
}
if (pt->synth_opts.branches) {
Powered by blists - more mailing lists