162306a36Sopenharmony_ciIntel Branch Trace Store
262306a36Sopenharmony_ci========================
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciOverview
562306a36Sopenharmony_ci========
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciIntel BTS could be regarded as a predecessor to Intel PT and has some
862306a36Sopenharmony_cisimilarities because it can also identify every branch a program takes.  A
962306a36Sopenharmony_cinotable difference is that Intel BTS has no timing information and as a
1062306a36Sopenharmony_ciconsequence the present implementation is limited to per-thread recording.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciWhile decoding Intel BTS does not require walking the object code, the object
1362306a36Sopenharmony_cicode is still needed to pair up calls and returns correctly, consequently much
1462306a36Sopenharmony_ciof the Intel PT documentation applies also to Intel BTS.  Refer to the Intel PT
1562306a36Sopenharmony_cidocumentation and consider that the PMU 'intel_bts' can usually be used in
1662306a36Sopenharmony_ciplace of 'intel_pt' in the examples provided, with the proviso that per-thread
1762306a36Sopenharmony_cirecording must also be stipulated i.e. the --per-thread option for
1862306a36Sopenharmony_ci'perf record'.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciperf record
2262306a36Sopenharmony_ci===========
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cinew event
2562306a36Sopenharmony_ci---------
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciThe Intel BTS kernel driver creates a new PMU for Intel BTS.  The perf record
2862306a36Sopenharmony_cioption is:
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	-e intel_bts//
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciCurrently Intel BTS is limited to per-thread tracing so the --per-thread option
3362306a36Sopenharmony_ciis also needed.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cisnapshot option
3762306a36Sopenharmony_ci---------------
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciThe snapshot option is the same as Intel PT (refer Intel PT documentation).
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciauxtrace mmap size option
4362306a36Sopenharmony_ci-----------------------
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciThe mmap size option is the same as Intel PT (refer Intel PT documentation).
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciperf script
4962306a36Sopenharmony_ci===========
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciBy default, perf script will decode trace data found in the perf.data file.
5262306a36Sopenharmony_ciThis can be further controlled by option --itrace.  The --itrace option is
5362306a36Sopenharmony_cithe same as Intel PT (refer Intel PT documentation) except that neither
5462306a36Sopenharmony_ci"instructions" events nor "transactions" events (and consequently call
5562306a36Sopenharmony_cichains) are supported.
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciTo disable trace decoding entirely, use the option --no-itrace.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cidump option
6162306a36Sopenharmony_ci-----------
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciperf script has an option (-D) to "dump" the events i.e. display the binary
6462306a36Sopenharmony_cidata.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciWhen -D is used, Intel BTS packets are displayed.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciTo disable the display of Intel BTS packets, combine the -D option with
6962306a36Sopenharmony_ci--no-itrace.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciperf report
7362306a36Sopenharmony_ci===========
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciBy default, perf report will decode trace data found in the perf.data file.
7662306a36Sopenharmony_ciThis can be further controlled by new option --itrace exactly the same as
7762306a36Sopenharmony_ciperf script.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciperf inject
8162306a36Sopenharmony_ci===========
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciperf inject also accepts the --itrace option in which case tracing data is
8462306a36Sopenharmony_ciremoved and replaced with the synthesized events. e.g.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci	perf inject --itrace -i perf.data -o perf.data.new
87