Received: by 10.223.185.116 with SMTP id b49csp1704952wrg; Sat, 17 Feb 2018 03:35:52 -0800 (PST) X-Google-Smtp-Source: AH8x224QSyTRzq4+hAmd19vH+cEUsOagBogsEngKKHf4vOBxJIUApv0S5bJCLfD5KgbfYXjjHqR6 X-Received: by 10.98.216.137 with SMTP id e131mr8600547pfg.17.1518867352102; Sat, 17 Feb 2018 03:35:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518867352; cv=none; d=google.com; s=arc-20160816; b=U+KjyZTSTie1k9Dfl6p9GS2FEbHDEmGiTbfYNesN2Tw3qLpluXxyJFw/FtmThAXVLv YL1/FnthKuG3EeaGVDe5153jXzw8/P09RD79PKg4Pra285oFIw/Mxx3N6Qno806iKEtw OnW80EHjLbkhLwApUYvh3oEG7TygyQI4wtkBi9UjikM1aq3fAsBww234LlbIVButeQLN 7ShPyDSdxGODVg3yk3olRYm9m5QWAMdqWWRWel0+iUw4SRtKC5j+v8yvy9739WwuDvfB s4F3fZvTiSEiuXNN0e2nKPLJ0bNmIwxjSgQB5km2HIvWU31i6dNgw9M2fjCk0zJBK1e+ lrrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=cXuskpBcP6jliZT1pqKAPThHSTXKASOyXB7PlvUzLOo=; b=QAKkojBIKrZ4861msOPUa6mo6cJQ3WbHHbsFXZoxNm8qhWfDwGHzqUGHwXyLzddgmb rqLU6R2fRG4S4WaOAGh67Ff2icDjoCHC60JNKzk6kaiXMKB/Q+n4pnkhXfX7ztkR/tWX WBHS+hVMaZSm6CSK3EwjCQ2wtPiSFGMWUEYeEBMBHx+9A0A5jtvs+nzvBGlm+TVMdCd7 Y18k5MB3Elkn/Gi87fYumtI0LzTBw3Jmyvmy1bNwEai0BpP2dznOyqYNCKo65/xQ8hi6 e9Uj59OH0NR6FpFgPvgKTK2S0Up8QjIA+ByZJSsxy/5FtLx8Lte2EdLyRnyFozRep1sn pBAw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s87si2789760pfj.396.2018.02.17.03.35.38; Sat, 17 Feb 2018 03:35:52 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751211AbeBQLer (ORCPT + 99 others); Sat, 17 Feb 2018 06:34:47 -0500 Received: from terminus.zytor.com ([198.137.202.136]:39393 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbeBQLep (ORCPT ); Sat, 17 Feb 2018 06:34:45 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1HBXQ7s007270; Sat, 17 Feb 2018 03:33:26 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1HBXPQT007262; Sat, 17 Feb 2018 03:33:25 -0800 Date: Sat, 17 Feb 2018 03:33:25 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Robert Walker Message-ID: Cc: hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, mathieu.poirier@linaro.org, robert.walker@arm.com, tglx@linutronix.de Reply-To: acme@redhat.com, robert.walker@arm.com, tglx@linutronix.de, mathieu.poirier@linaro.org, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <1518607481-4059-4-git-send-email-robert.walker@arm.com> References: <1518607481-4059-4-git-send-email-robert.walker@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] coresight: Update documentation for perf usage Git-Commit-ID: 6673016f874adee171690f95540ead5efddb5351 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6673016f874adee171690f95540ead5efddb5351 Gitweb: https://git.kernel.org/tip/6673016f874adee171690f95540ead5efddb5351 Author: Robert Walker AuthorDate: Wed, 14 Feb 2018 11:24:41 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 16 Feb 2018 14:55:46 -0300 coresight: Update documentation for perf usage Add notes on using perf to collect and analyze CoreSight trace Signed-off-by: Robert Walker Cc: Mathieu Poirier Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1518607481-4059-4-git-send-email-robert.walker@arm.com Signed-off-by: Arnaldo Carvalho de Melo --- Documentation/trace/coresight.txt | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt index a33c88c..6f0120c 100644 --- a/Documentation/trace/coresight.txt +++ b/Documentation/trace/coresight.txt @@ -330,3 +330,54 @@ Details on how to use the generic STM API can be found here [2]. [1]. Documentation/ABI/testing/sysfs-bus-coresight-devices-stm [2]. Documentation/trace/stm.txt + + +Using perf tools +---------------- + +perf can be used to record and analyze trace of programs. + +Execution can be recorded using 'perf record' with the cs_etm event, +specifying the name of the sink to record to, e.g: + + perf record -e cs_etm/@20070000.etr/u --per-thread + +The 'perf report' and 'perf script' commands can be used to analyze execution, +synthesizing instruction and branch events from the instruction trace. +'perf inject' can be used to replace the trace data with the synthesized events. +The --itrace option controls the type and frequency of synthesized events +(see perf documentation). + +Note that only 64-bit programs are currently supported - further work is +required to support instruction decode of 32-bit Arm programs. + + +Generating coverage files for Feedback Directed Optimization: AutoFDO +--------------------------------------------------------------------- + +'perf inject' accepts the --itrace option in which case tracing data is +removed and replaced with the synthesized events. e.g. + + perf inject --itrace --strip -i perf.data -o perf.data.new + +Below is an example of using ARM ETM for autoFDO. It requires autofdo +(https://github.com/google/autofdo) and gcc version 5. The bubble +sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tutorial). + + $ gcc-5 -O3 sort.c -o sort + $ taskset -c 2 ./sort + Bubble sorting array of 30000 elements + 5910 ms + + $ perf record -e cs_etm/@20070000.etr/u --per-thread taskset -c 2 ./sort + Bubble sorting array of 30000 elements + 12543 ms + [ perf record: Woken up 35 times to write data ] + [ perf record: Captured and wrote 69.640 MB perf.data ] + + $ perf inject -i perf.data -o inj.data --itrace=il64 --strip + $ create_gcov --binary=./sort --profile=inj.data --gcov=sort.gcov -gcov_version=1 + $ gcc-5 -O3 -fauto-profile=sort.gcov sort.c -o sort_autofdo + $ taskset -c 2 ./sort_autofdo + Bubble sorting array of 30000 elements + 5806 ms