From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752596AbdGAIzF (ORCPT ); Sat, 1 Jul 2017 04:55:05 -0400 Received: from terminus.zytor.com ([65.50.211.136]:53899 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751915AbdGAIzD (ORCPT ); Sat, 1 Jul 2017 04:55:03 -0400 Date: Sat, 1 Jul 2017 01:53:54 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, ak@linux.intel.com, acme@redhat.com Reply-To: tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, mingo@kernel.org, acme@redhat.com, ak@linux.intel.com In-Reply-To: <1495786658-18063-31-git-send-email-adrian.hunter@intel.com> References: <1495786658-18063-31-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf intel-pt: Tidy messages into called function intel_pt_synth_event() Git-Commit-ID: 63a22cd9f8400fe914ddc3d597d925594f212519 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: 63a22cd9f8400fe914ddc3d597d925594f212519 Gitweb: http://git.kernel.org/tip/63a22cd9f8400fe914ddc3d597d925594f212519 Author: Adrian Hunter AuthorDate: Fri, 26 May 2017 11:17:31 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 30 Jun 2017 11:44:35 -0300 perf intel-pt: Tidy messages into called function intel_pt_synth_event() Tidy print messages into called function intel_pt_synth_event(). Signed-off-by: Adrian Hunter Cc: Andi Kleen Link: http://lkml.kernel.org/r/1495786658-18063-31-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/intel-pt.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index a9486b5..81907f6 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -1910,16 +1910,25 @@ static int intel_pt_event_synth(struct perf_tool *tool, NULL); } -static int intel_pt_synth_event(struct perf_session *session, +static int intel_pt_synth_event(struct perf_session *session, const char *name, struct perf_event_attr *attr, u64 id) { struct intel_pt_synth intel_pt_synth; + int err; + + pr_debug("Synthesizing '%s' event with id %" PRIu64 " sample type %#" PRIx64 "\n", + name, id, (u64)attr->sample_type); memset(&intel_pt_synth, 0, sizeof(struct intel_pt_synth)); intel_pt_synth.session = session; - return perf_event__synthesize_attr(&intel_pt_synth.dummy_tool, attr, 1, - &id, intel_pt_event_synth); + err = perf_event__synthesize_attr(&intel_pt_synth.dummy_tool, attr, 1, + &id, intel_pt_event_synth); + if (err) + pr_err("%s: failed to synthesize '%s' event type\n", + __func__, name); + + return err; } static struct perf_evsel *intel_pt_evsel(struct intel_pt *pt, @@ -1984,14 +1993,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, attr.sample_type |= PERF_SAMPLE_CALLCHAIN; if (pt->synth_opts.last_branch) attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; - pr_debug("Synthesizing 'instructions' event with id %" PRIu64 " sample type %#" PRIx64 "\n", - id, (u64)attr.sample_type); - err = intel_pt_synth_event(session, &attr, id); - if (err) { - pr_err("%s: failed to synthesize 'instructions' event type\n", - __func__); + err = intel_pt_synth_event(session, "instructions", &attr, id); + if (err) return err; - } pt->sample_instructions = true; pt->instructions_sample_type = attr.sample_type; pt->instructions_id = id; @@ -2005,14 +2009,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, attr.sample_type |= PERF_SAMPLE_CALLCHAIN; if (pt->synth_opts.last_branch) attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; - pr_debug("Synthesizing 'transactions' event with id %" PRIu64 " sample type %#" PRIx64 "\n", - id, (u64)attr.sample_type); - err = intel_pt_synth_event(session, &attr, id); - if (err) { - pr_err("%s: failed to synthesize 'transactions' event type\n", - __func__); + err = intel_pt_synth_event(session, "transactions", &attr, id); + if (err) return err; - } pt->sample_transactions = true; pt->transactions_sample_type = attr.sample_type; pt->transactions_id = id; @@ -2033,14 +2032,9 @@ static int intel_pt_synth_events(struct intel_pt *pt, attr.sample_type |= PERF_SAMPLE_ADDR; attr.sample_type &= ~(u64)PERF_SAMPLE_CALLCHAIN; attr.sample_type &= ~(u64)PERF_SAMPLE_BRANCH_STACK; - pr_debug("Synthesizing 'branches' event with id %" PRIu64 " sample type %#" PRIx64 "\n", - id, (u64)attr.sample_type); - err = intel_pt_synth_event(session, &attr, id); - if (err) { - pr_err("%s: failed to synthesize 'branches' event type\n", - __func__); + err = intel_pt_synth_event(session, "branches", &attr, id); + if (err) return err; - } pt->sample_branches = true; pt->branches_sample_type = attr.sample_type; pt->branches_id = id;