1*4882a593Smuzhiyunperf-diff(1) 2*4882a593Smuzhiyun============ 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunNAME 5*4882a593Smuzhiyun---- 6*4882a593Smuzhiyunperf-diff - Read perf.data files and display the differential profile 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunSYNOPSIS 9*4882a593Smuzhiyun-------- 10*4882a593Smuzhiyun[verse] 11*4882a593Smuzhiyun'perf diff' [baseline file] [data file1] [[data file2] ... ] 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunDESCRIPTION 14*4882a593Smuzhiyun----------- 15*4882a593SmuzhiyunThis command displays the performance difference amongst two or more perf.data 16*4882a593Smuzhiyunfiles captured via perf record. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunIf no parameters are passed it will assume perf.data.old and perf.data. 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunThe differential profile is displayed only for events matching both 21*4882a593Smuzhiyunspecified perf.data files. 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunIf no parameters are passed the samples will be sorted by dso and symbol. 24*4882a593SmuzhiyunAs the perf.data files could come from different binaries, the symbols addresses 25*4882a593Smuzhiyuncould vary. So perf diff is based on the comparison of the files and 26*4882a593Smuzhiyunsymbols name. 27*4882a593Smuzhiyun 28*4882a593SmuzhiyunOPTIONS 29*4882a593Smuzhiyun------- 30*4882a593Smuzhiyun-D:: 31*4882a593Smuzhiyun--dump-raw-trace:: 32*4882a593Smuzhiyun Dump raw trace in ASCII. 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun--kallsyms=<file>:: 35*4882a593Smuzhiyun kallsyms pathname 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun-m:: 38*4882a593Smuzhiyun--modules:: 39*4882a593Smuzhiyun Load module symbols. WARNING: use only with -k and LIVE kernel 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun-d:: 42*4882a593Smuzhiyun--dsos=:: 43*4882a593Smuzhiyun Only consider symbols in these dsos. CSV that understands 44*4882a593Smuzhiyun file://filename entries. This option will affect the percentage 45*4882a593Smuzhiyun of the Baseline/Delta column. See --percentage for more info. 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun-C:: 48*4882a593Smuzhiyun--comms=:: 49*4882a593Smuzhiyun Only consider symbols in these comms. CSV that understands 50*4882a593Smuzhiyun file://filename entries. This option will affect the percentage 51*4882a593Smuzhiyun of the Baseline/Delta column. See --percentage for more info. 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun-S:: 54*4882a593Smuzhiyun--symbols=:: 55*4882a593Smuzhiyun Only consider these symbols. CSV that understands 56*4882a593Smuzhiyun file://filename entries. This option will affect the percentage 57*4882a593Smuzhiyun of the Baseline/Delta column. See --percentage for more info. 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun-s:: 60*4882a593Smuzhiyun--sort=:: 61*4882a593Smuzhiyun Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline. 62*4882a593Smuzhiyun Please see description of --sort in the perf-report man page. 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun-t:: 65*4882a593Smuzhiyun--field-separator=:: 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun Use a special separator character and don't pad with spaces, replacing 68*4882a593Smuzhiyun all occurrences of this separator in symbol names (and other output) 69*4882a593Smuzhiyun with a '.' character, that thus it's the only non valid separator. 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun-v:: 72*4882a593Smuzhiyun--verbose:: 73*4882a593Smuzhiyun Be verbose, for instance, show the raw counts in addition to the 74*4882a593Smuzhiyun diff. 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun-q:: 77*4882a593Smuzhiyun--quiet:: 78*4882a593Smuzhiyun Do not show any message. (Suppress -v) 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun-f:: 81*4882a593Smuzhiyun--force:: 82*4882a593Smuzhiyun Don't do ownership validation. 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun--symfs=<directory>:: 85*4882a593Smuzhiyun Look for files with symbols relative to this directory. 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun-b:: 88*4882a593Smuzhiyun--baseline-only:: 89*4882a593Smuzhiyun Show only items with match in baseline. 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun-c:: 92*4882a593Smuzhiyun--compute:: 93*4882a593Smuzhiyun Differential computation selection - delta, ratio, wdiff, cycles, 94*4882a593Smuzhiyun delta-abs (default is delta-abs). Default can be changed using 95*4882a593Smuzhiyun diff.compute config option. See COMPARISON METHODS section for 96*4882a593Smuzhiyun more info. 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun--cycles-hist:: 99*4882a593Smuzhiyun Report a histogram and the standard deviation for cycles data. 100*4882a593Smuzhiyun It can help us to judge if the reported cycles data is noisy or 101*4882a593Smuzhiyun not. This option should be used with '-c cycles'. 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun-p:: 104*4882a593Smuzhiyun--period:: 105*4882a593Smuzhiyun Show period values for both compared hist entries. 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun-F:: 108*4882a593Smuzhiyun--formula:: 109*4882a593Smuzhiyun Show formula for given computation. 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun-o:: 112*4882a593Smuzhiyun--order:: 113*4882a593Smuzhiyun Specify compute sorting column number. 0 means sorting by baseline 114*4882a593Smuzhiyun overhead and 1 (default) means sorting by computed value of column 1 115*4882a593Smuzhiyun (data from the first file other base baseline). Values more than 1 116*4882a593Smuzhiyun can be used only if enough data files are provided. 117*4882a593Smuzhiyun The default value can be set using the diff.order config option. 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun--percentage:: 120*4882a593Smuzhiyun Determine how to display the overhead percentage of filtered entries. 121*4882a593Smuzhiyun Filters can be applied by --comms, --dsos and/or --symbols options. 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun "relative" means it's relative to filtered entries only so that the 124*4882a593Smuzhiyun sum of shown entries will be always 100%. "absolute" means it retains 125*4882a593Smuzhiyun the original value before and after the filter is applied. 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun--time:: 128*4882a593Smuzhiyun Analyze samples within given time window. It supports time 129*4882a593Smuzhiyun percent with multiple time ranges. Time string is 'a%/n,b%/m,...' 130*4882a593Smuzhiyun or 'a%-b%,c%-%d,...'. 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun For example: 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun Select the second 10% time slice to diff: 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun perf diff --time 10%/2 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun Select from 0% to 10% time slice to diff: 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun perf diff --time 0%-10% 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun Select the first and the second 10% time slices to diff: 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun perf diff --time 10%/1,10%/2 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun Select from 0% to 10% and 30% to 40% slices to diff: 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun perf diff --time 0%-10%,30%-40% 149*4882a593Smuzhiyun 150*4882a593Smuzhiyun It also supports analyzing samples within a given time window 151*4882a593Smuzhiyun <start>,<stop>. Times have the format seconds.nanoseconds. If 'start' 152*4882a593Smuzhiyun is not given (i.e. time string is ',x.y') then analysis starts at 153*4882a593Smuzhiyun the beginning of the file. If stop time is not given (i.e. time 154*4882a593Smuzhiyun string is 'x.y,') then analysis goes to the end of the file. 155*4882a593Smuzhiyun Multiple ranges can be separated by spaces, which requires the argument 156*4882a593Smuzhiyun to be quoted e.g. --time "1234.567,1234.789 1235," 157*4882a593Smuzhiyun Time string is'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps 158*4882a593Smuzhiyun for different perf.data files. 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun For example, we get the timestamp information from 'perf script'. 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun perf script -i perf.data.old 163*4882a593Smuzhiyun mgen 13940 [000] 3946.361400: ... 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun perf script -i perf.data 166*4882a593Smuzhiyun mgen 13940 [000] 3971.150589 ... 167*4882a593Smuzhiyun 168*4882a593Smuzhiyun perf diff --time 3946.361400,:3971.150589, 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun It analyzes the perf.data.old from the timestamp 3946.361400 to 171*4882a593Smuzhiyun the end of perf.data.old and analyzes the perf.data from the 172*4882a593Smuzhiyun timestamp 3971.150589 to the end of perf.data. 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun--cpu:: Only diff samples for the list of CPUs provided. Multiple CPUs can 175*4882a593Smuzhiyun be provided as a comma-separated list with no space: 0,1. Ranges of 176*4882a593Smuzhiyun CPUs are specified with -: 0-2. Default is to report samples on all 177*4882a593Smuzhiyun CPUs. 178*4882a593Smuzhiyun 179*4882a593Smuzhiyun--pid=:: 180*4882a593Smuzhiyun Only diff samples for given process ID (comma separated list). 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun--tid=:: 183*4882a593Smuzhiyun Only diff samples for given thread ID (comma separated list). 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun--stream:: 186*4882a593Smuzhiyun Enable hot streams comparison. Stream can be a callchain which is 187*4882a593Smuzhiyun aggregated by the branch records from samples. 188*4882a593Smuzhiyun 189*4882a593SmuzhiyunCOMPARISON 190*4882a593Smuzhiyun---------- 191*4882a593SmuzhiyunThe comparison is governed by the baseline file. The baseline perf.data 192*4882a593Smuzhiyunfile is iterated for samples. All other perf.data files specified on 193*4882a593Smuzhiyunthe command line are searched for the baseline sample pair. If the pair 194*4882a593Smuzhiyunis found, specified computation is made and result is displayed. 195*4882a593Smuzhiyun 196*4882a593SmuzhiyunAll samples from non-baseline perf.data files, that do not match any 197*4882a593Smuzhiyunbaseline entry, are displayed with empty space within baseline column 198*4882a593Smuzhiyunand possible computation results (delta) in their related column. 199*4882a593Smuzhiyun 200*4882a593SmuzhiyunExample files samples: 201*4882a593Smuzhiyun- file A with samples f1, f2, f3, f4, f6 202*4882a593Smuzhiyun- file B with samples f2, f4, f5 203*4882a593Smuzhiyun- file C with samples f1, f2, f5 204*4882a593Smuzhiyun 205*4882a593SmuzhiyunExample output: 206*4882a593Smuzhiyun x - computation takes place for pair 207*4882a593Smuzhiyun b - baseline sample percentage 208*4882a593Smuzhiyun 209*4882a593Smuzhiyun- perf diff A B C 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun baseline/A compute/B compute/C samples 212*4882a593Smuzhiyun --------------------------------------- 213*4882a593Smuzhiyun b x f1 214*4882a593Smuzhiyun b x x f2 215*4882a593Smuzhiyun b f3 216*4882a593Smuzhiyun b x f4 217*4882a593Smuzhiyun b f6 218*4882a593Smuzhiyun x x f5 219*4882a593Smuzhiyun 220*4882a593Smuzhiyun- perf diff B A C 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun baseline/B compute/A compute/C samples 223*4882a593Smuzhiyun --------------------------------------- 224*4882a593Smuzhiyun b x x f2 225*4882a593Smuzhiyun b x f4 226*4882a593Smuzhiyun b x f5 227*4882a593Smuzhiyun x x f1 228*4882a593Smuzhiyun x f3 229*4882a593Smuzhiyun x f6 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun- perf diff C B A 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun baseline/C compute/B compute/A samples 234*4882a593Smuzhiyun --------------------------------------- 235*4882a593Smuzhiyun b x f1 236*4882a593Smuzhiyun b x x f2 237*4882a593Smuzhiyun b x f5 238*4882a593Smuzhiyun x f3 239*4882a593Smuzhiyun x x f4 240*4882a593Smuzhiyun x f6 241*4882a593Smuzhiyun 242*4882a593SmuzhiyunCOMPARISON METHODS 243*4882a593Smuzhiyun------------------ 244*4882a593Smuzhiyundelta 245*4882a593Smuzhiyun~~~~~ 246*4882a593SmuzhiyunIf specified the 'Delta' column is displayed with value 'd' computed as: 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun d = A->period_percent - B->period_percent 249*4882a593Smuzhiyun 250*4882a593Smuzhiyunwith: 251*4882a593Smuzhiyun - A/B being matching hist entry from data/baseline file specified 252*4882a593Smuzhiyun (or perf.data/perf.data.old) respectively. 253*4882a593Smuzhiyun 254*4882a593Smuzhiyun - period_percent being the % of the hist entry period value within 255*4882a593Smuzhiyun single data file 256*4882a593Smuzhiyun 257*4882a593Smuzhiyun - with filtering by -C, -d and/or -S, period_percent might be changed 258*4882a593Smuzhiyun relative to how entries are filtered. Use --percentage=absolute to 259*4882a593Smuzhiyun prevent such fluctuation. 260*4882a593Smuzhiyun 261*4882a593Smuzhiyundelta-abs 262*4882a593Smuzhiyun~~~~~~~~~ 263*4882a593SmuzhiyunSame as 'delta` method, but sort the result with the absolute values. 264*4882a593Smuzhiyun 265*4882a593Smuzhiyunratio 266*4882a593Smuzhiyun~~~~~ 267*4882a593SmuzhiyunIf specified the 'Ratio' column is displayed with value 'r' computed as: 268*4882a593Smuzhiyun 269*4882a593Smuzhiyun r = A->period / B->period 270*4882a593Smuzhiyun 271*4882a593Smuzhiyunwith: 272*4882a593Smuzhiyun - A/B being matching hist entry from data/baseline file specified 273*4882a593Smuzhiyun (or perf.data/perf.data.old) respectively. 274*4882a593Smuzhiyun 275*4882a593Smuzhiyun - period being the hist entry period value 276*4882a593Smuzhiyun 277*4882a593Smuzhiyunwdiff:WEIGHT-B,WEIGHT-A 278*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~ 279*4882a593SmuzhiyunIf specified the 'Weighted diff' column is displayed with value 'd' computed as: 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun d = B->period * WEIGHT-A - A->period * WEIGHT-B 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun - A/B being matching hist entry from data/baseline file specified 284*4882a593Smuzhiyun (or perf.data/perf.data.old) respectively. 285*4882a593Smuzhiyun 286*4882a593Smuzhiyun - period being the hist entry period value 287*4882a593Smuzhiyun 288*4882a593Smuzhiyun - WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option 289*4882a593Smuzhiyun behind ':' separator like '-c wdiff:1,2'. 290*4882a593Smuzhiyun - WEIGHT-A being the weight of the data file 291*4882a593Smuzhiyun - WEIGHT-B being the weight of the baseline data file 292*4882a593Smuzhiyun 293*4882a593Smuzhiyuncycles 294*4882a593Smuzhiyun~~~~~~ 295*4882a593SmuzhiyunIf specified the '[Program Block Range] Cycles Diff' column is displayed. 296*4882a593SmuzhiyunIt displays the cycles difference of same program basic block amongst 297*4882a593Smuzhiyuntwo perf.data. The program basic block is the code between two branches. 298*4882a593Smuzhiyun 299*4882a593Smuzhiyun'[Program Block Range]' indicates the range of a program basic block. 300*4882a593SmuzhiyunSource line is reported if it can be found otherwise uses symbol+offset 301*4882a593Smuzhiyuninstead. 302*4882a593Smuzhiyun 303*4882a593SmuzhiyunSEE ALSO 304*4882a593Smuzhiyun-------- 305*4882a593Smuzhiyunlinkperf:perf-record[1], linkperf:perf-report[1] 306