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