From patchwork Wed Aug 1 21:36:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 143315 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1378828ljj; Wed, 1 Aug 2018 14:39:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcY8HSvX8gzBExQ+evnJjZRVykNXrXjojpXJ2Qae5VPAsfQReusYRVc26oTyBK3mO/jq6eA X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr46769plb.181.1533159566386; Wed, 01 Aug 2018 14:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533159566; cv=none; d=google.com; s=arc-20160816; b=Phcj11q5Z5jcET/SoPa8WmN+ZqCipGa2w/z3pPzTbA4nGoOO+u7oCxCdCkjtRz/vq8 QjTisBlgsR08f+vy1Aw8Q4k/jlOJDXTqO1vsTgG2KT6LxbVHt6KoLBfMovmk6tTEdTFN jGnGqVyZlhMODsBD1FkIBU/OkOND/htmqoZDlFRkexkT1Bmeer0tNX4Hylculp3qf7ik cftN8iJug06rAj3sbHWJj+mS5YQz7Z/RO2yqNPvvfYpsJPylJX20KyWKA+GSyTD+MtoV cXrNcSQ6KmFsK8ArhNuHeWJGXF7ZFksGy/gepEixw51nYKNGRij6RGKJvHXyL4PmBvyM 1kUQ== 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=+ho/dAztRl0NBinJdfduzic0XwDrf5rMeHeWU22OpIA=; b=CtLRPdsOWzIOEJlignr1qMjwVNNSGRINQ2Mr/RCVdaqqA8RE1LiWhpwqkxU82om9u3 ms0JX2adLHjc6WCuh93GJX36bHhqp2OVd9B29aMYsivWpNdOnLUgZQXedUyw8QAu8udq JFiAZKXEzi2Zn9qBWZns79Mbk5sKSij1W/WNqCA2wK6BeYgI1jaYnt+1m5mKbC8afSEB 2JpPrp2itrnJQkKqkeDOJZWa5xr+JGJOhBaXdyGvBABt68W6p5RtIJAzkCeTQN1+dLQL +pE8kKsX4mKn3jQ9HJ+xwxe/LWYyWlBcbTOGXfy/ytZyfJhbhu4DqeXt0QQ/liv4F82F j9GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a+rOsewF; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11-v6si73517pgm.154.2018.08.01.14.39.26; Wed, 01 Aug 2018 14:39:26 -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=@kernel.org header.s=default header.b=a+rOsewF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388672AbeHAXZg (ORCPT + 31 others); Wed, 1 Aug 2018 19:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:39628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388609AbeHAXZf (ORCPT ); Wed, 1 Aug 2018 19:25:35 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4971A208A5; Wed, 1 Aug 2018 21:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159467; bh=7PKxdmB4FcUBYEjNnAhtmm43wZS9a9WB6nlc3RVbQfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+rOsewFPObmsjQuhqrD48RJQj+qPrbMyJFjiHZeyAUifvKRX4n1SY4pQYdNqMpIQ /HGkFMHU2WDrZLcsRz9Ko/oQe6+UvMy040vzHGCVx3TC4+OV+jk5lEeqqLzMYJ2bTF pqt7RNZKQXjOeOw0Sl7S8EMRr08mVuVCUe2EAL0g= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Kim Phillips , Mike Leach , Namhyung Kim , Peter Zijlstra , Robert Walker , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 14/21] perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet Date: Wed, 1 Aug 2018 18:36:41 -0300 Message-Id: <20180801213648.4814-15-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan 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 Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-6-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.14.4 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 976db8483478..d3b794286bca 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) { /*