From patchwork Wed Jul 11 07:45:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 141688 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4803973ljj; Wed, 11 Jul 2018 00:47:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd0yQSAkxmpWVutQwan75dPy792dUSw1dvD5R/aWMtCTHAoLHOeF5ycpuvLx689YJllNG1b X-Received: by 2002:a65:4249:: with SMTP id d9-v6mr25735953pgq.362.1531295220289; Wed, 11 Jul 2018 00:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531295220; cv=none; d=google.com; s=arc-20160816; b=NcfUB6mQ9bBQsGgbMV1BYj7QrEC18NhKudYln0BWtJ5Iu3m0jnc6uc4utwFq/X0hhu 9qtT0YnEIUM/lVZdYd1agjll7jEd41MbfogpS/csVfCc8Br5Fyt27dV2vRR/KRwTdph9 Yh9H6NJDjbSgNtFSbbibnvbj04w+Onzu/M9C0h5eFVE6CI0P+sViZOAJ+dVj3+B5+iEf xqiE5l3q6Cp4uCvR4NxWJfD686/vY7M4fmf46yKT8gmf0GLclJ7kYJ9yLcoFPL7YvZkg VOVuCRlkZTOqb6w2/CaQqzvXkdlFjJEFwB824fAaKK7fP2FRY8fHFTYt3QOJYj0jc/++ XYgw== 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 w1-v6si20534852pfl.215.2018.07.11.00.47.00; Wed, 11 Jul 2018 00:47:00 -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 S1732331AbeGKHtz (ORCPT + 22 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(-) -- 2.7.4 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) {