From 194edf7f38c7416fca7ba4459bc4fb83aad07462 Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Wed, 1 May 2019 11:18:16 -0600 Subject: docs: coresight: Document snapshot mode Because of the resctriction imposed by the internal memory buffer of some CoreSight sink, using the framework in snapshot mode can be a little trickly. As such document the process to make user experience more enjoyable. Signed-off-by: Mathieu Poirier --- Documentation/trace/coresight.txt | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt index efbc832146e7..6c602ae379e2 100644 --- a/Documentation/trace/coresight.txt +++ b/Documentation/trace/coresight.txt @@ -363,7 +363,6 @@ The --itrace option controls the type and frequency of synthesized events 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 --------------------------------------------------------------------- @@ -394,6 +393,46 @@ sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tuto Bubble sorting array of 30000 elements 5806 ms +2.2) Snapshot mode: + +Using perf's built-in snapshot mode with CoreSight tracers is supported - to +do so the '-S' command line option needs to be specified. Since current sink +devices are used in double-buffer mode when operated from the perf interface, +the size of the perf ring buffer needs to be adjusted to match the size of the +buffer used by the CoreSight sinks. From the perf command line it is possible +to specify the number of pages to use for a session using the '-m,X' option, +where X is the amount of pages. + +The system memory buffer used by ETR devices is automatically adjusted +to match the size of the perf ring buffer and as such does not need to be +modified on the perf command line. For ETB and ETF devices the perf ring +buffer size need to be adjusted to match the size of the internal buffer. + +The following examples assume a system page size of 4096 byte: + + # cat /sys/bus/coresight/devices/20010000.etb/mgmt/rdp + 0x2000 + # perf record -e cs_etm/@20010000.etf/ -S -m,8 --per-thread $APP + + # cat /sys/bus/coresight/devices/20010000.etf/buffer_size + 0x10000 + # perf record -e cs_etm/@20010000.etf/ -S -m,16 --per-thread $APP + + # perf record -e cs_etm/@20070000.etr/ -S --per-thread $APP + +Once an application is launched trace snapshot are collected by sending the +USR2 message to the process being monitored: + + # perf record -e cs_etm/@20070000.etr/ -S --per-thread $APP & + [1] 14808 + # kill -USR2 14808 + ... + ... + # kill -USR2 14808 + ... + ... + # kill 14808 + How to use the STM module ------------------------- -- cgit v1.2.3