Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1816015imm; Thu, 2 Aug 2018 01:16:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe9VFypWK187Yi4vJR58FhVhasiydABm/w5LPJEyou3ctoSYCok86UELRJD7Ni+EYDvDmrt X-Received: by 2002:a63:ca09:: with SMTP id n9-v6mr455535pgi.287.1533197768623; Thu, 02 Aug 2018 01:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533197768; cv=none; d=google.com; s=arc-20160816; b=Y+tWcS7IhMf2RjnWVrDuHYgLaShWx53CLJ87g7GhjwuDYq2cAHNlRk8mS0KNCYoENK EdRlDjYTQVdhobIO0h8WDLxUqxfEjCMEKBFXuKMAukCcQtgT4lKZp2D09sTtK2/8LL59 3ZqOFTPFhQxP7AKycjGdc+i10tfeqGuW7f+L9NQMbvkEoT3/YA6xQCvZv6/u6tV/SmN7 Rh0jRhtbM2yR8jS/sJT/85XKhHNeF5lbsO9JNcqUIDUhfnqiI2MbLP8hq4pty82OzWty wLJ1ht8gVoLa7JrpI4nPqnVgrnpyQmGrh+plKTK0v77MG9dFLQw0cZoSth+Q+yuYskly jXtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=PcD77XOjVBmXjgjICBakluouNGQJyivkRBb7xLo9q0w=; b=KPTcZBs2kRvl6ToWLuZs/MSnk4dgvlrDoYgvtcJXEBehaoEzD7GMuVLDu1F8oX3Yeg 7ta4I9DyfK/XvUN8xNYi96mwqaR54Wr+RKysiB9YY8GPapfDNQacbbC224BfRxnFzycM HwrFPBkgYiOH3heqL2vSkTo28uXyYyPzjAT0nud2tQb4u9eCiieJzhKF2ejSREqmapYM gHFT/OWZMpc7KwSMrk+jkFx6YPwsKyGhtQ5y1LcXW0HcqJxJahbrpo02OHvk8rlibOLT /m3kopPNfCadJgLPgKhxR4bnqeMeprPYZOEI9pvAFZq2hF5ZbRMzzHP0mIhdshdoA2dc +TWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si1348965pgl.620.2018.08.02.01.15.53; Thu, 02 Aug 2018 01:16:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731383AbeHBKFJ (ORCPT + 99 others); Thu, 2 Aug 2018 06:05:09 -0400 Received: from terminus.zytor.com ([198.137.202.136]:39301 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbeHBKFJ (ORCPT ); Thu, 2 Aug 2018 06:05:09 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w728EdbQ3431457 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Aug 2018 01:14:39 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w728Ed4a3431454; Thu, 2 Aug 2018 01:14:39 -0700 Date: Thu, 2 Aug 2018 01:14:39 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Leo Yan Message-ID: Cc: mingo@kernel.org, peterz@infradead.org, alexander.shishkin@linux.intel.com, leo.yan@linaro.org, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mathieu.poirier@linaro.org, acme@redhat.com, robert.walker@arm.com, mike.leach@linaro.org, hpa@zytor.com, kim.phillips@arm.com Reply-To: linux-kernel@vger.kernel.org, namhyung@kernel.org, jolsa@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, leo.yan@linaro.org, kim.phillips@arm.com, robert.walker@arm.com, hpa@zytor.com, mike.leach@linaro.org, tglx@linutronix.de, mathieu.poirier@linaro.org, acme@redhat.com In-Reply-To: <1531295145-596-7-git-send-email-leo.yan@linaro.org> References: <1531295145-596-7-git-send-email-leo.yan@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet Git-Commit-ID: 14a85b1eca348e00a9f209b522f94ec3ead94acb 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 X-Spam-Status: No, score=-0.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96 autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 14a85b1eca348e00a9f209b522f94ec3ead94acb Gitweb: https://git.kernel.org/tip/14a85b1eca348e00a9f209b522f94ec3ead94acb Author: Leo Yan AuthorDate: Wed, 11 Jul 2018 15:45:45 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 31 Jul 2018 11:22:50 -0300 perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet CS_ETM_TRACE_ON packet itself can give the info that there have a discontinuity in the trace, this patch is to add branch sample for CS_ETM_TRACE_ON packet if it is inserted in the middle of CS_ETM_RANGE packets; as result we can have hint for the trace discontinuity. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-7-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index d3b794286bca..2ae640257fdb 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -910,13 +910,23 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) etmq->period_instructions = instrs_over; } - if (etm->sample_branches && - etmq->prev_packet && - etmq->prev_packet->sample_type == CS_ETM_RANGE && - etmq->prev_packet->last_instr_taken_branch) { - ret = cs_etm__synth_branch_sample(etmq); - if (ret) - return ret; + if (etm->sample_branches && etmq->prev_packet) { + bool generate_sample = false; + + /* Generate sample for tracing on packet */ + if (etmq->prev_packet->sample_type == CS_ETM_TRACE_ON) + generate_sample = true; + + /* Generate sample for branch taken packet */ + if (etmq->prev_packet->sample_type == CS_ETM_RANGE && + etmq->prev_packet->last_instr_taken_branch) + generate_sample = true; + + if (generate_sample) { + ret = cs_etm__synth_branch_sample(etmq); + if (ret) + return ret; + } } if (etm->sample_branches || etm->synth_opts.last_branch) {