xref: /linux/tools/perf/Documentation/perf-diff.txt (revision 21a8b756b84ecaa0b7f29199669c151e2ce5e723)
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
23OPTIONS
24-------
25-D::
26--dump-raw-trace::
27        Dump raw trace in ASCII.
28
29-m::
30--modules::
31        Load module symbols. WARNING: use only with -k and LIVE kernel
32
33-d::
34--dsos=::
35	Only consider symbols in these dsos. CSV that understands
36	file://filename entries.  This option will affect the percentage
37	of the Baseline/Delta column.  See --percentage for more info.
38
39-C::
40--comms=::
41	Only consider symbols in these comms. CSV that understands
42	file://filename entries.  This option will affect the percentage
43	of the Baseline/Delta column.  See --percentage for more info.
44
45-S::
46--symbols=::
47	Only consider these symbols. CSV that understands
48	file://filename entries.  This option will affect the percentage
49	of the Baseline/Delta column.  See --percentage for more info.
50
51-s::
52--sort=::
53	Sort by key(s): pid, comm, dso, symbol.
54
55-t::
56--field-separator=::
57
58	Use a special separator character and don't pad with spaces, replacing
59	all occurrences of this separator in symbol names (and other output)
60	with a '.' character, that thus it's the only non valid separator.
61
62-v::
63--verbose::
64	Be verbose, for instance, show the raw counts in addition to the
65	diff.
66
67-f::
68--force::
69       Don't complain, do it.
70
71--symfs=<directory>::
72        Look for files with symbols relative to this directory.
73
74-b::
75--baseline-only::
76        Show only items with match in baseline.
77
78-c::
79--compute::
80        Differential computation selection - delta,ratio,wdiff (default is delta).
81        See COMPARISON METHODS section for more info.
82
83-p::
84--period::
85        Show period values for both compared hist entries.
86
87-F::
88--formula::
89        Show formula for given computation.
90
91-o::
92--order::
93       Specify compute sorting column number.
94
95--percentage::
96	Determine how to display the overhead percentage of filtered entries.
97	Filters can be applied by --comms, --dsos and/or --symbols options.
98
99	"relative" means it's relative to filtered entries only so that the
100	sum of shown entries will be always 100%.  "absolute" means it retains
101	the original value before and after the filter is applied.
102
103COMPARISON
104----------
105The comparison is governed by the baseline file. The baseline perf.data
106file is iterated for samples. All other perf.data files specified on
107the command line are searched for the baseline sample pair. If the pair
108is found, specified computation is made and result is displayed.
109
110All samples from non-baseline perf.data files, that do not match any
111baseline entry, are displayed with empty space within baseline column
112and possible computation results (delta) in their related column.
113
114Example files samples:
115- file A with samples f1, f2, f3, f4,    f6
116- file B with samples     f2,     f4, f5
117- file C with samples f1, f2,         f5
118
119Example output:
120  x - computation takes place for pair
121  b - baseline sample percentage
122
123- perf diff A B C
124
125  baseline/A compute/B compute/C  samples
126  ---------------------------------------
127  b                    x          f1
128  b          x         x          f2
129  b                               f3
130  b          x                    f4
131  b                               f6
132             x         x          f5
133
134- perf diff B A C
135
136  baseline/B compute/A compute/C  samples
137  ---------------------------------------
138  b          x         x          f2
139  b          x                    f4
140  b                    x          f5
141             x         x          f1
142             x                    f3
143             x                    f6
144
145- perf diff C B A
146
147  baseline/C compute/B compute/A  samples
148  ---------------------------------------
149  b                    x          f1
150  b          x         x          f2
151  b          x                    f5
152                       x          f3
153             x         x          f4
154                       x          f6
155
156COMPARISON METHODS
157------------------
158delta
159~~~~~
160If specified the 'Delta' column is displayed with value 'd' computed as:
161
162  d = A->period_percent - B->period_percent
163
164with:
165  - A/B being matching hist entry from data/baseline file specified
166    (or perf.data/perf.data.old) respectively.
167
168  - period_percent being the % of the hist entry period value within
169    single data file
170
171  - with filtering by -C, -d and/or -S, period_percent might be changed
172    relative to how entries are filtered.  Use --percentage=absolute to
173    prevent such fluctuation.
174
175ratio
176~~~~~
177If specified the 'Ratio' column is displayed with value 'r' computed as:
178
179  r = A->period / B->period
180
181with:
182  - A/B being matching hist entry from data/baseline file specified
183    (or perf.data/perf.data.old) respectively.
184
185  - period being the hist entry period value
186
187wdiff:WEIGHT-B,WEIGHT-A
188~~~~~~~~~~~~~~~~~~~~~~~
189If specified the 'Weighted diff' column is displayed with value 'd' computed as:
190
191   d = B->period * WEIGHT-A - A->period * WEIGHT-B
192
193  - A/B being matching hist entry from data/baseline file specified
194    (or perf.data/perf.data.old) respectively.
195
196  - period being the hist entry period value
197
198  - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
199    behind ':' separator like '-c wdiff:1,2'.
200    - WIEGHT-A being the weight of the data file
201    - WIEGHT-B being the weight of the baseline data file
202
203SEE ALSO
204--------
205linkperf:perf-record[1]
206