From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752615AbdGAIz1 (ORCPT ); Sat, 1 Jul 2017 04:55:27 -0400 Received: from terminus.zytor.com ([65.50.211.136]:40921 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbdGAIzZ (ORCPT ); Sat, 1 Jul 2017 04:55:25 -0400 Date: Sat, 1 Jul 2017 01:54:16 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: acme@redhat.com, adrian.hunter@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, ak@linux.intel.com, tglx@linutronix.de Reply-To: mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, adrian.hunter@intel.com, acme@redhat.com, tglx@linutronix.de, ak@linux.intel.com In-Reply-To: <1495786658-18063-32-git-send-email-adrian.hunter@intel.com> References: <1495786658-18063-32-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf intel-pt: Factor out intel_pt_set_event_name() Git-Commit-ID: bbac88ed64436201d6b6f2b00177d58081d56707 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: bbac88ed64436201d6b6f2b00177d58081d56707 Gitweb: http://git.kernel.org/tip/bbac88ed64436201d6b6f2b00177d58081d56707 Author: Adrian Hunter AuthorDate: Fri, 26 May 2017 11:17:32 +0300 Committer: Arnaldo Carvalho de Melo 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 Cc: Andi Kleen Link: http://lkml.kernel.org/r/1495786658-18063-32-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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) {