From patchwork Mon Jun 18 05:09:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 10469421 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 61ED16032A for ; Mon, 18 Jun 2018 05:18:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52C82287FA for ; Mon, 18 Jun 2018 05:18:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47B4D28800; Mon, 18 Jun 2018 05:18:15 +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 C9F8A287FA for ; Mon, 18 Jun 2018 05:18:14 +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=2vpt9vTU9xntKV1Aqqk58jFxMCksnC96Xw5yb0AGfSs=; b=PqOKq7JJduXTIRYXfgGOi7Ap7k 3CDmmqnzAoaIfZhyxSmJLp1qSNp4J4SURrduKvbF6FH1lf6WGz9XBP7Y/KI3gMB0Fm5yRDIjR88qy 4n3W3w40c5xKcSzl8y58i95DKTBWlCL6mMbwPH13EGPTxI6s6LXbU6rTjDCzsME/mysgmzL5Yyucj AJjxd8dmRHDcCwtMba2zGnz3Qd1+uLS3oRcHAc44tqwixBIp7ZJcquwuIVWi48DVZNkdM1OJsqr3x Q90lFuUFxbPZ1gwbbr4ogzNMXdypw+B0wnClL8Rhgsd3EibRPLLSuy3GDyVWawsYHzN+khreVd84R Hvs1fK+g==; 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 1fUmYM-0006te-W7; Mon, 18 Jun 2018 05:18:11 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUmRT-0003Fm-Ke for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 05:11:10 +0000 Received: by mail-pg0-x242.google.com with SMTP id m5-v6so6966462pgd.3 for ; Sun, 17 Jun 2018 22:10:53 -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=x4bCg0+QmGBErc/o9N6g33Yfeba+eCNRT/trwWTp3QM=; b=OyyjVDI+JmXNJCagSbatad/T/dqDZJk1jZWxeKF4K7sl7emYbGYdrFsfcKHSmf/Qcf cfxExGlwfxdBWfvgvRLcR9abTdyhQJGQ4igbfZR9nCgBGJrGGRDxQ9a7CvRx/Xh8XXCS dKty8p8y2v4Zc8wq/tNb6kwGBmctX/2tSV7IE= 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=x4bCg0+QmGBErc/o9N6g33Yfeba+eCNRT/trwWTp3QM=; b=MU4CMErTR+uvAslkrpLB4/beZa6g7QeCzcanUHDccQAuTAl7FYVJksoJT1WRt0rQDw 8KMyAlVKf44knOH1+yA6gR3qpKLne5yMNPW4+sshjCSgnJbTbgsaTKKL+AgMgjQHxj4j CISQM0lgo5IvHSGKWLMoi+IzIsyF9O3CcY6kPC6Tb1GApUKb6j3kZ/0Wt8L5lzOIOzxT NyV7+tyB7Lqt4e1AQI9c73znkp1N1c4f5izhZUiCqrEvtq76wucTwfUTtRFgvahTqfI2 O3Hb8NfoHSh3g5XzrARfuCUZlToyTgqJ6q0E/hFjgEa6axeal2vmOZ5OXAbgcdz/dloj RBEg== X-Gm-Message-State: APt69E0wyMComtkII61xxNc9a3Zvb0v9kTN/RpTGbkyfcI1SkeJDgzZB 0xAtG3opzIpactEdKEmBa6ERIg== X-Google-Smtp-Source: ADUXVKKB6KOp1TXUmjNcTJYXJfDeo9BBXmE0MepSLFLXSqBcv7lRhuCNQxZ3tWHMfxZ/9ISUJrGeUg== X-Received: by 2002:a65:6343:: with SMTP id p3-v6mr9803912pgv.63.1529298652894; Sun, 17 Jun 2018 22:10:52 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jun 2018 22:10:52 -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 5/6] perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet Date: Mon, 18 Jun 2018 13:09:58 +0800 Message-Id: <1529298599-3876-6-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_221103_719079_7ED70744 X-CRM114-Status: GOOD ( 13.08 ) 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 If one CS_ETM_TRACE_ON packet is inserted, we miss to generate branch sample for the previous CS_ETM_RANGE packet. This patch is to generate branch sample when receiving a CS_ETM_TRACE_ON packet, so this can save complete info for the previous CS_ETM_RANGE packet just before CS_ETM_TRACE_ON packet. Signed-off-by: Leo Yan --- tools/perf/util/cs-etm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 976db84..d3b7942 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -935,6 +935,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) static int cs_etm__flush(struct cs_etm_queue *etmq) { int err = 0; + struct cs_etm_auxtrace *etm = etmq->etm; struct cs_etm_packet *tmp; if (!etmq->prev_packet) @@ -965,6 +966,13 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) } + if (etm->sample_branches && + etmq->prev_packet->sample_type == CS_ETM_RANGE) { + err = cs_etm__synth_branch_sample(etmq); + if (err) + return err; + } + swap_packet: if (etmq->etm->synth_opts.last_branch) { /*