Skip to content

perf tools: Introduce an abstraction for AUX Area and Instruction Tracing

Adrian Hunter lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest44 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/44perf header: Add AUX area tracing featuretools/perf/util/header.c tools/perf/util/header.h+15 -00 replies
2/44perf evlist: Add support for mmapping an AUX area buffertools/perf/util/Build tools/perf/util/auxtrace.c tools/perf/util/auxtrace.h +2 more+294 -30 replies
3/44perf tools: Add user events for AUX area tracingtools/perf/util/event.c tools/perf/util/event.h tools/perf/util/session.c +1 more+101 -13 replies
4/44perf tools: Add support for AUX area recordingtools/perf/perf.h tools/perf/util/auxtrace.c tools/perf/util/auxtrace.h +1 more+243 -21 reply
5/44perf record: Add basic AUX area tracing supporttools/perf/builtin-record.c+77 -40 replies
6/44perf record: Extend -m option for AUX area tracing mmap pagestools/perf/Documentation/perf-record.txt tools/perf/builtin-record.c tools/perf/util/evlist.c +1 more+56 -60 replies
7/44perf tools: Add a user event for AUX area tracing errorstools/perf/util/event.c tools/perf/util/event.h tools/perf/util/session.c +1 more+44 -10 replies
8/44perf session: Add hooks to allow transparent decoding of AUX area tracing datatools/perf/util/auxtrace.h tools/perf/util/session.c tools/perf/util/session.h+102 -102 replies
9/44perf session: Add instruction tracing optionstools/perf/util/auxtrace.c tools/perf/util/auxtrace.h tools/perf/util/session.h+176 -03 replies
10/44perf auxtrace: Add helpers for AUX area tracing errorstools/perf/util/auxtrace.c tools/perf/util/auxtrace.h tools/perf/util/event.h +1 more+104 -00 replies
11/44perf auxtrace: Add helpers for queuing AUX area tracing datatools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+392 -01 reply
12/44perf auxtrace: Add a heap for sorting AUX area tracing queuestools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+114 -01 reply
13/44perf auxtrace: Add processing for AUX area tracing eventstools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+64 -10 replies
14/44perf auxtrace: Add a hashtable for cachingtools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+137 -00 replies
15/44perf tools: Add member to struct dso for an instruction cachetools/perf/util/dso.c tools/perf/util/dso.h+5 -00 replies
16/44perf script: Add Instruction Tracing supporttools/perf/Documentation/perf-script.txt tools/perf/builtin-script.c+39 -00 replies
17/44perf script: Always allow fields 'addr' and 'cpu' for auxtracetools/perf/builtin-script.c+22 -70 replies
18/44perf report: Add Instruction Tracing supporttools/perf/Documentation/perf-report.txt tools/perf/builtin-report.c+39 -01 reply
19/44perf inject: Re-pipe AUX area tracing eventstools/perf/builtin-inject.c+58 -51 reply
20/44perf inject: Add Instruction Tracing supporttools/perf/Documentation/perf-inject.txt tools/perf/builtin-inject.c+96 -20 replies
21/44perf tools: Add AUX area tracing indextools/perf/builtin-inject.c tools/perf/builtin-record.c tools/perf/util/auxtrace.c +4 more+311 -40 replies
22/44perf tools: Hit all build ids when AUX area tracingtools/perf/builtin-buildid-list.c tools/perf/builtin-inject.c tools/perf/builtin-record.c+25 -20 replies
23/44perf tools: Add build option NO_AUXTRACE to exclude AUX area tracingtools/perf/Makefile.perf tools/perf/builtin-inject.c tools/perf/builtin-record.c +4 more+185 -201 reply
24/44perf auxtrace: Add option to synthesize events for transactionstools/perf/Documentation/perf-report.txt tools/perf/Documentation/perf-script.txt tools/perf/util/auxtrace.c +1 more+16 -90 replies
25/44perf script: Add field option 'flags' to print sample flagstools/perf/Documentation/perf-script.txt tools/perf/builtin-script.c tools/perf/util/event.h+39 -60 replies
26/44perf tools: Add aux_watermark member of struct perf_event_attrtools/perf/util/evsel.c tools/perf/util/session.c+2 -00 replies
27/44perf tools: Add support for PERF_RECORD_AUXtools/perf/builtin-inject.c tools/perf/util/event.c tools/perf/util/event.h +4 more+63 -00 replies
28/44perf tools: Add support for PERF_RECORD_ITRACE_STARTtools/perf/builtin-inject.c tools/perf/util/event.c tools/perf/util/event.h +4 more+59 -00 replies
29/44perf tools: Add AUX area tracing Snapshot Modetools/perf/perf.h tools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+119 -100 replies
30/44perf record: Add AUX area tracing Snapshot Mode supporttools/perf/Documentation/perf-record.txt tools/perf/builtin-record.c tools/perf/util/auxtrace.h +1 more+145 -210 replies
31/44perf auxtrace: Add Intel PT as an AUX area tracing typetools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+2 -00 replies
32/44perf tools: Add Intel PT packet decodertools/perf/util/Build tools/perf/util/intel-pt-decoder/Build tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +1 more+466 -00 replies
33/44perf tools: Add Intel PT instruction decodertools/build/Makefile.build tools/perf/.gitignore tools/perf/Makefile.perf +3 more+333 -30 replies
34/44perf tools: Add Intel PT logtools/perf/util/intel-pt-decoder/Build tools/perf/util/intel-pt-decoder/intel-pt-log.c tools/perf/util/intel-pt-decoder/intel-pt-log.h+208 -10 replies
35/44perf tools: Add Intel PT decodertools/perf/util/intel-pt-decoder/Build tools/perf/util/intel-pt-decoder/intel-pt-decoder.c tools/perf/util/intel-pt-decoder/intel-pt-decoder.h+1828 -10 replies
36/44perf tools: Add Intel PT supporttools/perf/util/Build tools/perf/util/intel-pt.c tools/perf/util/intel-pt.h+2667 -00 replies
37/44perf tools: Take Intel PT into usetools/perf/Documentation/intel-pt.txt tools/perf/arch/x86/util/Build tools/perf/arch/x86/util/auxtrace.c +2 more+597 -10 replies
38/44perf tools: Allow auxtrace data alignmenttools/perf/util/auxtrace.c tools/perf/util/auxtrace.h+8 -00 replies
39/44perf tools: Add Intel BTS supporttools/perf/Documentation/intel-bts.txt tools/perf/arch/x86/util/auxtrace.c tools/perf/util/Build +4 more+1373 -30 replies
40/44perf tools: Output sample flags and insn_len from intel_pttools/perf/util/intel-pt.c+4 -00 replies
41/44perf tools: Output sample flags and insn_len from intel_btstools/perf/util/intel-bts.c+124 -40 replies
42/44perf tools: Intel PT to always update thread stack trace numbertools/perf/util/intel-pt.c+3 -10 replies
43/44perf tools: Intel BTS to always update thread stack trace numbertools/perf/util/intel-bts.c+14 -40 replies
44/44perf tools: Add example call-graph scripttools/perf/scripts/python/call-graph-from-postgresql.py+285 -00 replies

Reviews trailers per patch

6 of 44 patches have a Reviewed-by or Acked-by.

PatchJiri Olsa
1/44A-b
2/44
3/44A-b
4/44A-b
5/44A-b
6/44A-b
7/44A-b
8/44
9/44
10/44
11/44
12/44
13/44
14/44
15/44
16/44
17/44
18/44
19/44
20/44
21/44
22/44
23/44
24/44
25/44
26/44
27/44
28/44
29/44
30/44
31/44
32/44
33/44
34/44
35/44
36/44
37/44
38/44
39/44
40/44
41/44
42/44
43/44
44/44

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/44] perf tools: Introduce an abstraction for AUX Area and Instruction Tracing

Hi

Here are patches for the introduction of an abstraction for using the AUX area and Instruction tracing. This patch set now include support for Intel PT / Intel BTS.

The first 25 patches have been sent before and some have Jiri's acks. One patch that Jiri acked "perf evlist: Add support for mmapping an AUX area buffer" has been since modified slightly so I dropped the ack.

Intel BTS can be used on most recent Intel CPUs. Intel PT is available on Broadwell.

Examples:

Trace 'ls' with Intel BTS userspace only

perf record --per-thread -e intel_bts//u ls perf report
perf script

Trace 'ls' with Intel BTS kernel and userspace

~/libexec/perf-core/perf-with-kcore record bts-ls --per-thread -e intel_bts// -- ls ~/libexec/perf-core/perf-with-kcore report bts-ls ~/libexec/perf-core/perf-with-kcore script bts-ls

Trace 'ls' with Intel PT userspace only

perf record -e intel_pt//u ls
perf report
perf script

Trace 'ls' with Intel PT kernel and userspace

~/libexec/perf-core/perf-with-kcore record pt-ls -e intel_pt// -- ls ~/libexec/perf-core/perf-with-kcore report pt-ls ~/libexec/perf-core/perf-with-kcore script pt-ls

The abstraction has two separate aspects:
1. recording AUX area data
2. processing AUX area data

Recording consists of mmapping a separate buffer and copying the data into the perf.data file. The buffer is an AUX area buffer. The data is written preceded by a new user event PERF_RECORD_AUXTRACE. The data is too big to fit in the event but follows immediately afterward. Session processing has to skip to get to the next event header in a similar fashion to the existing PERF_RECORD_HEADER_TRACING_DATA
event. The main recording patches are:

perf evlist: Add support for mmapping an AUX area buffer perf tools: Add user events for AUX area tracing perf tools: Add support for AUX area recording perf record: Add basic AUX area tracing support

Processing consists of providing hooks in session processing to enable a decoder to see all the events and deliver synthesized events transparently into the event stream. The main processing patch is:

perf session: Add hooks to allow transparent decoding of AUX area tracing data

Adrian Hunter (44):
perf header: Add AUX area tracing feature
perf evlist: Add support for mmapping an AUX area buffer
perf tools: Add user events for AUX area tracing
perf tools: Add support for AUX area recording
perf record: Add basic AUX area tracing support
perf record: Extend -m option for AUX area tracing mmap pages perf tools: Add a user event for AUX area tracing errors
perf session: Add hooks to allow transparent decoding of AUX area tracing data perf session: Add instruction tracing options
perf auxtrace: Add helpers for AUX area tracing errors
perf auxtrace: Add helpers for queuing AUX area tracing data perf auxtrace: Add a heap for sorting AUX area tracing queues perf auxtrace: Add processing for AUX area tracing events
perf auxtrace: Add a hashtable for caching
perf tools: Add member to struct dso for an instruction cache perf script: Add Instruction Tracing support
perf script: Always allow fields 'addr' and 'cpu' for auxtrace perf report: Add Instruction Tracing support
perf inject: Re-pipe AUX area tracing events
perf inject: Add Instruction Tracing support
perf tools: Add AUX area tracing index
perf tools: Hit all build ids when AUX area tracing
perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing perf auxtrace: Add option to synthesize events for transactions perf script: Add field option 'flags' to print sample flags
perf tools: Add aux_watermark member of struct perf_event_attr perf tools: Add support for PERF_RECORD_AUX
perf tools: Add support for PERF_RECORD_ITRACE_START
perf tools: Add AUX area tracing Snapshot Mode
perf record: Add AUX area tracing Snapshot Mode support
perf auxtrace: Add Intel PT as an AUX area tracing type
perf tools: Add Intel PT packet decoder
perf tools: Add Intel PT instruction decoder
perf tools: Add Intel PT log
perf tools: Add Intel PT decoder
perf tools: Add Intel PT support
perf tools: Take Intel PT into use
perf tools: Allow auxtrace data alignment
perf tools: Add Intel BTS support
perf tools: Output sample flags and insn_len from intel_pt
perf tools: Output sample flags and insn_len from intel_bts
perf tools: Intel PT to always update thread stack trace number perf tools: Intel BTS to always update thread stack trace number perf tools: Add example call-graph script

 tools/build/Makefile.build                         |    2 +
 tools/perf/.gitignore                              |    2 +
 tools/perf/Documentation/intel-bts.txt             |   67 +
 tools/perf/Documentation/intel-pt.txt              |  537 ++++
 tools/perf/Documentation/perf-inject.txt           |   27 +
 tools/perf/Documentation/perf-record.txt           |    9 +
 tools/perf/Documentation/perf-report.txt           |   29 +
 tools/perf/Documentation/perf-script.txt           |   38 +-
 tools/perf/Makefile.perf                           |    8 +-
 tools/perf/arch/x86/util/Build                     |    3 +
 tools/perf/arch/x86/util/auxtrace.c                |   82 +
 tools/perf/arch/x86/util/pmu.c                     |   15 +
 tools/perf/builtin-buildid-list.c                  |    9 +
 tools/perf/builtin-inject.c                        |  174 +-
 tools/perf/builtin-record.c                        |  270 +-
 tools/perf/builtin-report.c                        |   11 +
 tools/perf/builtin-script.c                        |   74 +-
 tools/perf/config/Makefile                         |    5 +
 tools/perf/perf.h                                  |    5 +
 .../scripts/python/call-graph-from-postgresql.py   |  285 +++
 tools/perf/tests/make                              |    2 +
 tools/perf/util/Build                              |    4 +
 tools/perf/util/auxtrace.c                         | 1362 ++++++++++
 tools/perf/util/auxtrace.h                         |  646 +++++
 tools/perf/util/dso.c                              |    2 +
 tools/perf/util/dso.h                              |    3 +
 tools/perf/util/event.c                            |   42 +
 tools/perf/util/event.h                            |   70 +
 tools/perf/util/evlist.c                           |   71 +-
 tools/perf/util/evlist.h                           |    6 +
 tools/perf/util/evsel.c                            |    1 +
 tools/perf/util/header.c                           |   37 +
 tools/perf/util/header.h                           |    1 +
 tools/perf/util/intel-bts.c                        | 1353 ++++++++++
 tools/perf/util/intel-bts.h                        |   31 +
 tools/perf/util/intel-pt-decoder/Build             |   14 +
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 1738 +++++++++++++
 .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |   89 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |  246 ++
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |   65 +
 tools/perf/util/intel-pt-decoder/intel-pt-log.c    |  155 ++
 tools/perf/util/intel-pt-decoder/intel-pt-log.h    |   52 +
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   |  400 +++
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   64 +
 tools/perf/util/intel-pt.c                         | 2637 ++++++++++++++++++++
 tools/perf/util/intel-pt.h                         |   35 +
 tools/perf/util/machine.c                          |   21 +
 tools/perf/util/machine.h                          |    4 +
 tools/perf/util/parse-options.h                    |    4 +
 tools/perf/util/record.c                           |   11 +-
 tools/perf/util/session.c                          |  184 +-
 tools/perf/util/session.h                          |    6 +
 tools/perf/util/tool.h                             |   12 +-
 53 files changed, 10971 insertions(+), 49 deletions(-)
 create mode 100644 tools/perf/Documentation/intel-bts.txt
 create mode 100644 tools/perf/Documentation/intel-pt.txt
 create mode 100644 tools/perf/arch/x86/util/auxtrace.c
 create mode 100644 tools/perf/arch/x86/util/pmu.c
 create mode 100644 tools/perf/scripts/python/call-graph-from-postgresql.py
 create mode 100644 tools/perf/util/auxtrace.c
 create mode 100644 tools/perf/util/auxtrace.h
 create mode 100644 tools/perf/util/intel-bts.c
 create mode 100644 tools/perf/util/intel-bts.h
 create mode 100644 tools/perf/util/intel-pt-decoder/Build
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.h
 create mode 100644 tools/perf/util/intel-pt.c
 create mode 100644 tools/perf/util/intel-pt.h

Regards
Adrian