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