6 perf-diff - Read perf.data files and display the differential profile
11 'perf diff' [baseline file] [data file1] [[data file2] ... ]
15 This command displays the performance difference amongst two or more perf.data
16 files captured via perf record.
18 If no parameters are passed it will assume perf.data.old and perf.data.
20 The differential profile is displayed only for events matching both
21 specified perf.data files.
23 If no parameters are passed the samples will be sorted by dso and symbol.
24 As the perf.data files could come from different binaries, the symbols addresses
25 could vary. So perf diff is based on the comparison of the files and
32 Dump raw trace in ASCII.
39 Load module symbols. WARNING: use only with -k and LIVE kernel
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.
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.
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.
61 Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline.
62 Please see description of --sort in the perf-report man page.
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.
73 Be verbose, for instance, show the raw counts in addition to the
78 Do not show any message. (Suppress -v)
82 Don't do ownership validation.
85 Look for files with symbols relative to this directory.
89 Show only items with match in baseline.
93 Differential computation selection - delta, ratio, wdiff, cycles,
94 delta-abs (default is delta-abs). Default can be changed using
95 diff.compute config option. See COMPARISON METHODS section for
99 Report a histogram and the standard deviation for cycles data.
100 It can help us to judge if the reported cycles data is noisy or
101 not. This option should be used with '-c cycles'.
105 Show period values for both compared hist entries.
109 Show formula for given computation.
113 Specify compute sorting column number. 0 means sorting by baseline
114 overhead and 1 (default) means sorting by computed value of column 1
115 (data from the first file other base baseline). Values more than 1
116 can be used only if enough data files are provided.
117 The default value can be set using the diff.order config option.
120 Determine how to display the overhead percentage of filtered entries.
121 Filters can be applied by --comms, --dsos and/or --symbols options.
123 "relative" means it's relative to filtered entries only so that the
124 sum of shown entries will be always 100%. "absolute" means it retains
125 the original value before and after the filter is applied.
128 Analyze samples within given time window. It supports time
129 percent with multiple time ranges. Time string is 'a%/n,b%/m,...'
130 or 'a%-b%,c%-%d,...'.
134 Select the second 10% time slice to diff:
136 perf diff --time 10%/2
138 Select from 0% to 10% time slice to diff:
140 perf diff --time 0%-10%
142 Select the first and the second 10% time slices to diff:
144 perf diff --time 10%/1,10%/2
146 Select from 0% to 10% and 30% to 40% slices to diff:
148 perf diff --time 0%-10%,30%-40%
150 It also supports analyzing samples within a given time window
151 <start>,<stop>. Times have the format seconds.nanoseconds. If 'start'
152 is not given (i.e. time string is ',x.y') then analysis starts at
153 the beginning of the file. If stop time is not given (i.e. time
154 string is 'x.y,') then analysis goes to the end of the file.
155 Multiple ranges can be separated by spaces, which requires the argument
156 to be quoted e.g. --time "1234.567,1234.789 1235,"
157 Time string is'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps
158 for different perf.data files.
160 For example, we get the timestamp information from 'perf script'.
162 perf script -i perf.data.old
163 mgen 13940 [000] 3946.361400: ...
165 perf script -i perf.data
166 mgen 13940 [000] 3971.150589 ...
168 perf diff --time 3946.361400,:3971.150589,
170 It analyzes the perf.data.old from the timestamp 3946.361400 to
171 the end of perf.data.old and analyzes the perf.data from the
172 timestamp 3971.150589 to the end of perf.data.
174 --cpu:: Only diff samples for the list of CPUs provided. Multiple CPUs can
175 be provided as a comma-separated list with no space: 0,1. Ranges of
176 CPUs are specified with -: 0-2. Default is to report samples on all
180 Only diff samples for given process ID (comma separated list).
183 Only diff samples for given thread ID (comma separated list).
187 The comparison is governed by the baseline file. The baseline perf.data
188 file is iterated for samples. All other perf.data files specified on
189 the command line are searched for the baseline sample pair. If the pair
190 is found, specified computation is made and result is displayed.
192 All samples from non-baseline perf.data files, that do not match any
193 baseline entry, are displayed with empty space within baseline column
194 and possible computation results (delta) in their related column.
196 Example files samples:
197 - file A with samples f1, f2, f3, f4, f6
198 - file B with samples f2, f4, f5
199 - file C with samples f1, f2, f5
202 x - computation takes place for pair
203 b - baseline sample percentage
207 baseline/A compute/B compute/C samples
208 ---------------------------------------
218 baseline/B compute/A compute/C samples
219 ---------------------------------------
229 baseline/C compute/B compute/A samples
230 ---------------------------------------
242 If specified the 'Delta' column is displayed with value 'd' computed as:
244 d = A->period_percent - B->period_percent
247 - A/B being matching hist entry from data/baseline file specified
248 (or perf.data/perf.data.old) respectively.
250 - period_percent being the % of the hist entry period value within
253 - with filtering by -C, -d and/or -S, period_percent might be changed
254 relative to how entries are filtered. Use --percentage=absolute to
255 prevent such fluctuation.
259 Same as 'delta` method, but sort the result with the absolute values.
263 If specified the 'Ratio' column is displayed with value 'r' computed as:
265 r = A->period / B->period
268 - A/B being matching hist entry from data/baseline file specified
269 (or perf.data/perf.data.old) respectively.
271 - period being the hist entry period value
273 wdiff:WEIGHT-B,WEIGHT-A
274 ~~~~~~~~~~~~~~~~~~~~~~~
275 If specified the 'Weighted diff' column is displayed with value 'd' computed as:
277 d = B->period * WEIGHT-A - A->period * WEIGHT-B
279 - A/B being matching hist entry from data/baseline file specified
280 (or perf.data/perf.data.old) respectively.
282 - period being the hist entry period value
284 - WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option
285 behind ':' separator like '-c wdiff:1,2'.
286 - WEIGHT-A being the weight of the data file
287 - WEIGHT-B being the weight of the baseline data file
291 If specified the '[Program Block Range] Cycles Diff' column is displayed.
292 It displays the cycles difference of same program basic block amongst
293 two perf.data. The program basic block is the code between two branches.
295 '[Program Block Range]' indicates the range of a program basic block.
296 Source line is reported if it can be found otherwise uses symbol+offset
301 linkperf:perf-record[1], linkperf:perf-report[1]