Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp215364imm; Wed, 11 Jul 2018 00:48:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfnUjtsXDkoz9WuepyIb5T4aFCmR/wGyhADL3sp/IVxmdHjUdMCBe/hSM0T/gcy5fT0wVhG X-Received: by 2002:a63:b91c:: with SMTP id z28-v6mr25708043pge.22.1531295328496; Wed, 11 Jul 2018 00:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531295328; cv=none; d=google.com; s=arc-20160816; b=eyNyvWsMWIHncKyomex2J8XIjFemV49/Dsk0Ri45QBo3XjU0Bbt74cgxeRvv6OCbra krrq5t3/U7y9CzWXUs1of/fybMqXcvbbfLdKajA2yAY9KB4SaK7Vr/WZrTFcCnQEX3+8 xtfDVdQOmRZGEloSfv3TQUZUiYHvzPeUjNza/JtYSG+DKACiJ/6GxfomytytOnLr4CPV H5krbXO8nnGHP4KxlgWXAkgIv1mYbAeu74ucLatgCglqohLmXR7TpF6A3OGDOobYPsgk RThf252VywuA+NHhRDuxZoNJMHCJ16knMkL4RxS4SS8UdxZjDEX0TO4myh3CBHFT2EC0 DpjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=q2cz7hS4ymUe508HKlZEdy7VtTg+KDUjwdA1vqoP2wM=; b=RBZ086aocE4uNDytdCroHCBNnm+vuM/+Y+KGSqPYku2POVdN9pxvEXpI6m4XQH6LQa l2Lsb75IpDXK2CtVCXM7xTJU74v+DnNVi6Ra8sGPTEDFD11pFFZQohPxK0HzxBFtXUis hJbNSFB+eUb5w80v3zllJmRZ93NnYIK1dYHq/J44W78P+8AroE2sobAHWZ+9rTF/iWs3 oBBH6LnDs5+/azC+1eJiJG4QS2f1tSQMbimXWMXr9e/5hppRhX/SZxsgTTBBO0XM6vyI ksWEfVtJCANLoM/K77VVxhwUINSH7wn6QqsNEWkciIZLSUsGTJC+IgFn5NqIS7PirtZY uDww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h7Xtv+YT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17-v6si17740920plp.219.2018.07.11.00.48.33; Wed, 11 Jul 2018 00:48:48 -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; dkim=pass header.i=@linaro.org header.s=google header.b=h7Xtv+YT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732326AbeGKHtz (ORCPT + 99 others); Wed, 11 Jul 2018 03:49:55 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33665 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732303AbeGKHtz (ORCPT ); Wed, 11 Jul 2018 03:49:55 -0400 Received: by mail-pg1-f195.google.com with SMTP id r5-v6so2648475pgv.0 for ; Wed, 11 Jul 2018 00:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q2cz7hS4ymUe508HKlZEdy7VtTg+KDUjwdA1vqoP2wM=; b=h7Xtv+YTPIWuCzsvcxgE0fOLvKn7EC/Vst3Nvg1vSZHKr1BAsymKCEM5YMpsPQyibq adk44DUmKMhhVqhkgH0OWps1Y6/XAzaCp2jz6Xte+YcjC5U6Xa/ki1cjpNyEPzQxcv35 UqHMOUAuWx58WGjqhUwwAsfoXANPK+OeJ+ZKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q2cz7hS4ymUe508HKlZEdy7VtTg+KDUjwdA1vqoP2wM=; b=SbvOG1vaW7KNUXZ4M2900zLSpiJCR0bg4kWhkfOYJ+0SVRY+1GgVNIfWSZTMoSe46p 5h/A4pLKSglm0z9ly0cYL+CmEgD/fNNx53JRfWRO64HV4BtpvrslWDquNnaeAoRKUhMX 6QfCra/5O3qUCvHAxdHi5X2HOO3d+74Pas/8erh9xZfFH+bUdJCMxqkgOs/A2fbOJcPu 4wgYwDYLp3C+y7i46COZGs80iFR/YVNuVL/4+UMVqYxRjx5/wEs31/nXSzSraK4g6cY3 8hT7A8UwQ4m3rEC3BVmU5lfJUn7p09FcjWxln+Q4YL3xlpprAchstZ7N1JzvSqh6qozS aSgA== X-Gm-Message-State: APt69E1EQjV0Ap5mkrqfkB8n62dOb5aY86VkSaV+xuowpGLVSsZL3+Rt mkptmKRAUW0pdEeqcW7woqVu1A== X-Received: by 2002:a65:64cf:: with SMTP id t15-v6mr25393915pgv.79.1531295216858; Wed, 11 Jul 2018 00:46:56 -0700 (PDT) Received: from localhost.localdomain (li1192-169.members.linode.com. [45.79.93.169]) by smtp.gmail.com with ESMTPSA id 16-v6sm9260374pfp.6.2018.07.11.00.46.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jul 2018 00:46:56 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mike Leach , Robert Walker , Kim Phillips Cc: Leo Yan Subject: [PATCH v2 6/6] perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet Date: Wed, 11 Jul 2018 15:45:45 +0800 Message-Id: <1531295145-596-7-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531295145-596-1-git-send-email-leo.yan@linaro.org> References: <1531295145-596-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Mathieu Poirier Signed-off-by: Leo Yan --- 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 d3b7942..2ae6402 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) { -- 2.7.4