From patchwork Mon Jun 18 05:09:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 10469423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A35D96029B for ; Mon, 18 Jun 2018 05:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8899C28558 for ; Mon, 18 Jun 2018 05:18:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BDB428563; Mon, 18 Jun 2018 05:18:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C76828558 for ; Mon, 18 Jun 2018 05:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7ZaLOY22Rbp0JJoATJJ9jqo1Sq4Nn25XAA4pjz5ZWtY=; b=FZcOfdP67ba7kb8zl0IyCeO/3J JE3DwXWEB6ND4g9tqnYsXzZAWRMxWMGbTrO9muJSwFqyiLiNosDqH3k0hB8dyjsS3QDZOGNtRzka8 AViriNo/E4C3Oe5+lFBINjq9139/tOf0IfqmDUi+oNp1lNAOARKJYNXRx/jWYeihGQOB3Mjg1MNQp sK7xZ/xca1z+Am/3SyuWQ+J0URykeQju6bnE5kZtq+tdF0HxYiz/X0XWMJ0byx9mwybkB1f/mSIoZ X1WJ1NvfW0bxqpfkGl0Z7BYBMKkcHQqOha2CsOlzw0xiTc2wq7Vn+dD7vArnC5oN26Lj114llfZbz FejMDrXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUmYW-00071o-VR; Mon, 18 Jun 2018 05:18:20 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUmRX-0003ID-OK for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 05:11:16 +0000 Received: by mail-pl0-x243.google.com with SMTP id 30-v6so8346260pld.13 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=rgEJBkrhZJGZ0NMdF2euZFSX7cUThi1GGvhclDghM6eiC796d/HZrIhotpJ8aur4Cg 3YxdBTeVdALGsPJyrr7GOakTLD9wWCHluEG+8iF8oyk6EduEuRHzRb0DB+z+WYY5P5AN ECopHacxVeqHNv6HwfgQMtzmkSclQ9MJikk27/1hTk1KMI29jQwClgyQ64FGgIVmIdAV gLPHgFTIFTGmEKz0b1j7DejehIPoj9KmshJzoxHyHXHj3hBXjtevZaSsrACr2hRqIuHD NnfIaedynibhcNmkw3S4DwlVKroMsH1WcwIn664GkSMoWiokgvko94YGmM8ePIO1ZlPP 07cw== X-Gm-Message-State: APt69E35xOpKV1TDO8uDYwntZoaMoabnKek2+Agw9hvJf7g5vBcBXT+A ViWKBAZY4HWZCE+GbnEM05AL7A== X-Google-Smtp-Source: ADUXVKIgqI9iXe5+/sZEQ7+m1F6a1Go/7FkZp/udMa32dHpHsM27rmlrGQcZYqOfvax8Ddwm0vy3Kw== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180617_221107_813347_D744D1B0 X-CRM114-Status: GOOD ( 15.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {