From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933971AbbI2Itx (ORCPT ); Tue, 29 Sep 2015 04:49:53 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37857 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933396AbbI2Ipq (ORCPT ); Tue, 29 Sep 2015 04:45:46 -0400 Date: Tue, 29 Sep 2015 01:45:35 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: hpa@zytor.com, adrian.hunter@intel.com, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, jolsa@redhat.com Reply-To: tglx@linutronix.de, jolsa@redhat.com, linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org, adrian.hunter@intel.com, hpa@zytor.com In-Reply-To: <1443186956-18718-14-git-send-email-adrian.hunter@intel.com> References: <1443186956-18718-14-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf intel-pt: Move branch filter logic Git-Commit-ID: 385e33063fb963f5cccb0a37fe539319b6481fa5 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: 385e33063fb963f5cccb0a37fe539319b6481fa5 Gitweb: http://git.kernel.org/tip/385e33063fb963f5cccb0a37fe539319b6481fa5 Author: Adrian Hunter AuthorDate: Fri, 25 Sep 2015 16:15:44 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 28 Sep 2015 16:58:27 -0300 perf intel-pt: Move branch filter logic intel_pt_synth_branch_sample() skips synthesizing if the branch does not match the branch filter. That logic was sitting in the middle of the function but is more efficiently placed at the start of the function, so move it. Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1443186956-18718-14-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/intel-pt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index c8bb5ca..2c01e72 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -891,6 +891,9 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq) union perf_event *event = ptq->event_buf; struct perf_sample sample = { .ip = 0, }; + if (pt->branches_filter && !(pt->branches_filter & ptq->flags)) + return 0; + event->sample.header.type = PERF_RECORD_SAMPLE; event->sample.header.misc = PERF_RECORD_MISC_USER; event->sample.header.size = sizeof(struct perf_event_header); @@ -909,9 +912,6 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq) sample.flags = ptq->flags; sample.insn_len = ptq->insn_len; - if (pt->branches_filter && !(pt->branches_filter & ptq->flags)) - return 0; - if (pt->synth_opts.inject) { ret = intel_pt_inject_event(event, &sample, pt->branches_sample_type,