1*4882a593SmuzhiyunIntel Branch Trace Store 2*4882a593Smuzhiyun======================== 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunOverview 5*4882a593Smuzhiyun======== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunIntel BTS could be regarded as a predecessor to Intel PT and has some 8*4882a593Smuzhiyunsimilarities because it can also identify every branch a program takes. A 9*4882a593Smuzhiyunnotable difference is that Intel BTS has no timing information and as a 10*4882a593Smuzhiyunconsequence the present implementation is limited to per-thread recording. 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunWhile decoding Intel BTS does not require walking the object code, the object 13*4882a593Smuzhiyuncode is still needed to pair up calls and returns correctly, consequently much 14*4882a593Smuzhiyunof the Intel PT documentation applies also to Intel BTS. Refer to the Intel PT 15*4882a593Smuzhiyundocumentation and consider that the PMU 'intel_bts' can usually be used in 16*4882a593Smuzhiyunplace of 'intel_pt' in the examples provided, with the proviso that per-thread 17*4882a593Smuzhiyunrecording must also be stipulated i.e. the --per-thread option for 18*4882a593Smuzhiyun'perf record'. 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun 21*4882a593Smuzhiyunperf record 22*4882a593Smuzhiyun=========== 23*4882a593Smuzhiyun 24*4882a593Smuzhiyunnew event 25*4882a593Smuzhiyun--------- 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunThe Intel BTS kernel driver creates a new PMU for Intel BTS. The perf record 28*4882a593Smuzhiyunoption is: 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun -e intel_bts// 31*4882a593Smuzhiyun 32*4882a593SmuzhiyunCurrently Intel BTS is limited to per-thread tracing so the --per-thread option 33*4882a593Smuzhiyunis also needed. 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun 36*4882a593Smuzhiyunsnapshot option 37*4882a593Smuzhiyun--------------- 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunThe snapshot option is the same as Intel PT (refer Intel PT documentation). 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun 42*4882a593Smuzhiyunauxtrace mmap size option 43*4882a593Smuzhiyun----------------------- 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunThe mmap size option is the same as Intel PT (refer Intel PT documentation). 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun 48*4882a593Smuzhiyunperf script 49*4882a593Smuzhiyun=========== 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunBy default, perf script will decode trace data found in the perf.data file. 52*4882a593SmuzhiyunThis can be further controlled by option --itrace. The --itrace option is 53*4882a593Smuzhiyunthe same as Intel PT (refer Intel PT documentation) except that neither 54*4882a593Smuzhiyun"instructions" events nor "transactions" events (and consequently call 55*4882a593Smuzhiyunchains) are supported. 56*4882a593Smuzhiyun 57*4882a593SmuzhiyunTo disable trace decoding entirely, use the option --no-itrace. 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun 60*4882a593Smuzhiyundump option 61*4882a593Smuzhiyun----------- 62*4882a593Smuzhiyun 63*4882a593Smuzhiyunperf script has an option (-D) to "dump" the events i.e. display the binary 64*4882a593Smuzhiyundata. 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunWhen -D is used, Intel BTS packets are displayed. 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunTo disable the display of Intel BTS packets, combine the -D option with 69*4882a593Smuzhiyun--no-itrace. 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun 72*4882a593Smuzhiyunperf report 73*4882a593Smuzhiyun=========== 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunBy default, perf report will decode trace data found in the perf.data file. 76*4882a593SmuzhiyunThis can be further controlled by new option --itrace exactly the same as 77*4882a593Smuzhiyunperf script. 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun 80*4882a593Smuzhiyunperf inject 81*4882a593Smuzhiyun=========== 82*4882a593Smuzhiyun 83*4882a593Smuzhiyunperf inject also accepts the --itrace option in which case tracing data is 84*4882a593Smuzhiyunremoved and replaced with the synthesized events. e.g. 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun perf inject --itrace -i perf.data -o perf.data.new 87