From patchwork Wed Jul 11 07:45:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 141687 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4803894ljj; Wed, 11 Jul 2018 00:46:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcJy/MuywFsTkXAu6JIQLY9WNndgoGLrjEXqXI+iv9CyF1GxZbVFI/3TQbbZk0o2YQHvWUs X-Received: by 2002:a63:2c0d:: with SMTP id s13-v6mr26149139pgs.37.1531295214808; Wed, 11 Jul 2018 00:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531295214; cv=none; d=google.com; s=arc-20160816; b=MZz2eBCY6lz/4MbYuiJSx0u/+vx55Sis6Jr7gNRh/KpcGAnqdUHA56VumTA7hoTCif 0APxLPKODn8zqzRte/K4WvUCYlA58K6CdP36NBWVb68L2Enw9KCtopswEeYvlA32p/YB lH/DL9JVQS/aSK0DptAR+h1i15U7U8HTbYm1AJo1hfFrHBPHTaeg4Su9GYWs0FbJsLRz THOAAaIfPOq88DcwhUjPGOk4qEtmcD0QAIbMIJ3YYh1mLGITyxx6/PtaccbU5Ujzv9zP fyKvt3m5h7qeW6eTMtr8q7ZFfpEFNdehJkSCPWCNjzSSdUQ+o2lWThlr64bgEIOYJgXL 6d+A== 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=XMQ9y3sIKTBhWg+aMmgR4c+8RQ5KqVUSz/E0xmozD0A=; b=GJ+irP8uoS7RrdBGlk7nZreF08xh7pYfGaJ7Sx5TMRUCXzi1wY7fCrvAzMfAlK4NKX 2/lKv5WGjPDyeXr8qsXUbz9/rHDTM8hiXWdU0LA0dEVotBDru06DKZNVGWq7vHRNiJkO Apsf1xpzNSz1Yg+vvDX7LA5m06zsX2kPB2IEjnzDnpCqLwcMdPkRVRn7aou4XjRAB/08 M5KSblDG/1T8Gf6QZErJ4ZY+8txPdzJz9WhLh2hh4H7ZeIuYWW94LCfybAmfI9ur7TEq yqKgNtx7AkVQb2/o9VlQC4Ris4/cpa37+iAYkNo6cauneQQfcTWZKFoS9qRhv1Eri1Uk jnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fi9O/5uZ"; 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 q4-v6si18637423plb.251.2018.07.11.00.46.54; Wed, 11 Jul 2018 00:46:54 -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="fi9O/5uZ"; 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 S1732289AbeGKHtt (ORCPT + 22 others); Wed, 11 Jul 2018 03:49:49 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39547 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726312AbeGKHtt (ORCPT ); Wed, 11 Jul 2018 03:49:49 -0400 Received: by mail-pl0-f67.google.com with SMTP id s24-v6so8809570plq.6 for ; Wed, 11 Jul 2018 00:46:51 -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=XMQ9y3sIKTBhWg+aMmgR4c+8RQ5KqVUSz/E0xmozD0A=; b=fi9O/5uZlfCqJZApmRCZlROkMwiUzTJ1HpFl6g0HkcGHrOWzAgQwd+uu9Y2C7X8Fdl ZwQAS6BFAPmsRYEJYr5sXFmZkZQy9akfL1WEwvpIiqUULeRtv+tspKwjtXmLMN49pB3L uqH+BYc7dsPSFAwENwLBOxIc2z5fxaQUymIrk= 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=XMQ9y3sIKTBhWg+aMmgR4c+8RQ5KqVUSz/E0xmozD0A=; b=PfcWwvri3cUx9Pr6OBkTfzsV5vWmem7N91pAHLRrRK7sY+YrnnQ/xyJoAqhuyesnqg DTtT3N7/iqpaGllcD6YNcDHUg4aAtHsOaaFlxJ+9Bv2tVGSHyhlO0u/Z1L3Vga/YSc1c FokRrZXNGd+fFuxG4Y0By4lUAa9vsWKF/uGcLlEAZjbiG5asjscWbPMKRGa42tx8VRz2 5LzEKedQcLsaVKBUhXDT6CCkR8yk+Nlld4gGRiuUL5SAmFKFkEWdigB++vjRf5Uia3T0 y2ppbOv4lTinV2/yvvMrACT0M95fejHysTCzrQDIls6VAXS6uhv7A7hIQiOJyBWHaS6c rGWQ== X-Gm-Message-State: APt69E1ANCJA09ejiCl74A6+G3t/+VWWjvoNlTlAsFeoVwU9X0VeT560 hbICFg0Ez407Eb3ibbFbj4LU6WholDU= X-Received: by 2002:a17:902:600d:: with SMTP id r13-v6mr27952646plj.70.1531295211467; Wed, 11 Jul 2018 00:46:51 -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.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jul 2018 00:46:50 -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 5/6] perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet Date: Wed, 11 Jul 2018 15:45:44 +0800 Message-Id: <1531295145-596-6-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 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. Reviewed-by: Mathieu Poirier Signed-off-by: Leo Yan --- tools/perf/util/cs-etm.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 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) { /*