-Intel Processor Trace
-=====================
+perf-intel-pt(1)
+================
-Overview
-========
+NAME
+----
+perf-intel-pt - Support for Intel Processor Trace within perf tools
+
+SYNOPSIS
+--------
+[verse]
+'perf record' -e intel_pt//
+
+DESCRIPTION
+-----------
Intel Processor Trace (Intel PT) is an extension of Intel Architecture that
collects information about software execution such as control flow, execution
Quickstart
-==========
+----------
It is important to start small. That is because it is easy to capture vastly
more data than can possibly be processed.
perf record
-===========
+-----------
new event
----------
+~~~~~~~~~
The Intel PT kernel driver creates a new PMU for Intel PT. PMU events are
selected by providing the PMU name followed by the "config" separated by slashes.
config terms
-------------
+~~~~~~~~~~~~
The June 2015 version of Intel 64 and IA-32 Architectures Software Developer
Manuals, Chapter 36 Intel Processor Trace, defined new Intel PT features.
AUX area sampling option
-------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~
To select Intel PT "sampling" the AUX area sampling option can be used:
new snapshot option
--------------------
+~~~~~~~~~~~~~~~~~~~
The difference between full trace and snapshot from the kernel's perspective is
that in full trace we don't overwrite trace data that the user hasn't collected
new auxtrace mmap size option
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Intel PT buffer size is specified by an addition to the -m option e.g.
Intel PT modes of operation
----------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
Intel PT can be used in 2 modes:
full-trace mode
Buffer handling
----------------
+~~~~~~~~~~~~~~~
There may be buffer limitations (i.e. single ToPa entry) which means that actual
buffer sizes are limited to powers of 2 up to 4MiB (MAX_ORDER). In order to
Intel PT and build ids
-----------------------
+~~~~~~~~~~~~~~~~~~~~~~
By default "perf record" post-processes the event stream to find all build ids
for executables for all addresses sampled. Deliberately, Intel PT is not
Snapshot mode and event disabling
----------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order to make a snapshot, the intel_pt event is disabled using an IOCTL,
namely PERF_EVENT_IOC_DISABLE. However doing that can also disable the
perf record modes (nothing new here)
-------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
perf record essentially operates in one of three modes:
per thread
Privileged vs non-privileged users
-----------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unless /proc/sys/kernel/perf_event_paranoid is set to -1, unprivileged users
have memory limits imposed upon them. That affects what buffer sizes they can
sched_switch tracepoint
------------------------
+~~~~~~~~~~~~~~~~~~~~~~~
The sched_switch tracepoint is used to provide side-band data for Intel PT
decoding in kernels where the PERF_RECORD_SWITCH metadata event isn't
perf script
-===========
+-----------
By default, perf script will decode trace data found in the perf.data file.
This can be further controlled by new option --itrace.
New --itrace option
--------------------
+~~~~~~~~~~~~~~~~~~~
Having no option is the same as
skips the first million instructions.
dump option
------------
+~~~~~~~~~~~
perf script has an option (-D) to "dump" the events i.e. display the binary
data.
perf report
-===========
+-----------
By default, perf report will decode trace data found in the perf.data file.
This can be further controlled by new option --itrace exactly the same as
perf inject
-===========
+-----------
perf inject also accepts the --itrace option in which case tracing data is
removed and replaced with the synthesized events. e.g.
PEBS via Intel PT
-=================
+-----------------
Some hardware has the feature to redirect PEBS records to the Intel PT trace.
Recording is selected by using the aux-output config term e.g.