Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3507166imm; Sun, 17 Jun 2018 22:12:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKy/Pp4y0S+1LXen7n7SuMaepSyujuCZnw0INbqVo1hVqEL8XxzMJPZMsZoTLry5CTlFPN9 X-Received: by 2002:a17:902:4545:: with SMTP id m63-v6mr12614412pld.268.1529298734271; Sun, 17 Jun 2018 22:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529298734; cv=none; d=google.com; s=arc-20160816; b=Y3kkPLFoWivYPeTyQP5jQE5KTgtT5JBYGKVdLonfcGxX0FBvQgTN5S9zfkrk2TFb4n cIzIo1CC++w/o9zgEgR/S95egePw8V/VoIK8T1gca546VhH7IRrdDUXMnWlxAIKhePZO yS1cpYH3VE30rbS1JOAFkUkoLnI7TqDIB1STqzsKQ+fcO/MJC4cvlrtH6VGBSFqwWUeo 7hgsVfDxaWdHHnvO1yfEKdk/cIdHBpUhWyMlFkLLTznrnFGOahMoBEh5GVX70lCaFEJw n9MCAqBPHQ3fulUX1UfMbusoXYdA5zYgH1FL7ZfxjKP3AnZjiOui79WFGMEIwu0VZM4n H2NQ== 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=Gd2fy0/Z7eDf8iwKzTR/pYByVowIHmmoYAASyMjR3u4=; b=EJd9Iijp7rDBJI3Eta/txfXvVlEIL9fBqgeiufn41DpUO4OBvgmkAqclu8sUDYaYPj p6XLXyY5mvAPVEAG3GapS4JQbVlxbnYQ54CpzjjUeWZMGh9xQUy/FslNt0YSO3+UQp7V hGtoGczdOf7CwRMp2PYHmmDq+5+JCGfZhMOSphUVBkpnBIj5q+yYN4O8EkitmaNPqhxG 1ReD7GFFl81snv4/1fvV0RfwBVTv4rE9MfmGFQcY69vNU94TCjFgY5iyZjWwNZzcigGY bowizeDwGheTbY8K9iW39GRrNqFyIrFJF4YNZBHZFjGAXP89e5Buq9cp6FQxfEDiYLrS ogtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QU0ptk9R; 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 s6-v6si11055056pgp.603.2018.06.17.22.12.00; Sun, 17 Jun 2018 22:12:14 -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=QU0ptk9R; 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 S1754842AbeFRFLK (ORCPT + 99 others); Mon, 18 Jun 2018 01:11:10 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35270 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754793AbeFRFK5 (ORCPT ); Mon, 18 Jun 2018 01:10:57 -0400 Received: by mail-pl0-f67.google.com with SMTP id k1-v6so8368252plt.2 for ; Sun, 17 Jun 2018 22:10: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=Gd2fy0/Z7eDf8iwKzTR/pYByVowIHmmoYAASyMjR3u4=; b=QU0ptk9RwODRXdDVXA6KMqe/5VRxS/nIgh0gTSbLtLTrup+r6IPVnLoybL1Vgfjm5p Zrzd4Icsb4sDwruJCTtv4TWzRVOhQHspoDdiPkfvNg5ZHQBp4M3Zc2tjL1e8SB5DIr9S dmu/nz9pWFB5kWe1DgXRjxGlW/5q5cTNwf92A= 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=Gd2fy0/Z7eDf8iwKzTR/pYByVowIHmmoYAASyMjR3u4=; b=XEnocCx63TgW21pVIOkZ8vsWJrclWJlElmRIMTDujm7tTmKutowcAxI1FcZVggA+y7 cZ/R5kPZ03kyQaFTB63NL//36hcClLAC2R7tConT2C0N131VpFHN03h/3GfeItdwjsMR weBuHBn7ZxolWmzCfpnyIGxP9Ri8R+nw9UMu3WFhppTF2yXzvbmHgtYv04WtBANYLcMc yENEI/2v/faJa4B9mmFLx7xGvGMeLD7FC+Ky+6meQIieSbPofyR0muER9vxYYrp6cesd Bt4xpqrS1Ps8uCuts/N1GE0zvKwngqMmZESLVWcXe/9nV1cLkE6x/V1S5c7NrK5rdpd9 S8fw== X-Gm-Message-State: APt69E2UwIGBBeRObkw1TN+xeqnbbYUzTwA0d0DDBfIMkQohRsp2EfIX l8MS8GoK6Vq/4ouUzBj3atPiNQ== X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr12676679pll.186.1529298657213; Sun, 17 Jun 2018 22:10:57 -0700 (PDT) Received: from localhost.localdomain (li1181-92.members.linode.com. [45.79.82.92]) by smtp.gmail.com with ESMTPSA id l15-v6sm29051710pfg.88.2018.06.17.22.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jun 2018 22:10: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 v1 6/6] perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet Date: Mon, 18 Jun 2018 13:09:59 +0800 Message-Id: <1529298599-3876-7-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529298599-3876-1-git-send-email-leo.yan@linaro.org> References: <1529298599-3876-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. 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