Path: blob/master/tools/perf/Documentation/perf-diff.txt
26282 views
perf-diff(1)1============23NAME4----5perf-diff - Read perf.data files and display the differential profile67SYNOPSIS8--------9[verse]10'perf diff' [baseline file] [data file1] [[data file2] ... ]1112DESCRIPTION13-----------14This command displays the performance difference amongst two or more perf.data15files captured via perf record.1617If no parameters are passed it will assume perf.data.old and perf.data.1819The differential profile is displayed only for events matching both20specified perf.data files.2122If no parameters are passed the samples will be sorted by dso and symbol.23As the perf.data files could come from different binaries, the symbols addresses24could vary. So perf diff is based on the comparison of the files and25symbols name.2627OPTIONS28-------29-D::30--dump-raw-trace::31Dump raw trace in ASCII.3233--kallsyms=<file>::34kallsyms pathname3536-m::37--modules::38Load module symbols. WARNING: use only with -k and LIVE kernel3940-d::41--dsos=::42Only consider symbols in these dsos. CSV that understands43file://filename entries. This option will affect the percentage44of the Baseline/Delta column. See --percentage for more info.4546-C::47--comms=::48Only consider symbols in these comms. CSV that understands49file://filename entries. This option will affect the percentage50of the Baseline/Delta column. See --percentage for more info.5152-S::53--symbols=::54Only consider these symbols. CSV that understands55file://filename entries. This option will affect the percentage56of the Baseline/Delta column. See --percentage for more info.5758-s::59--sort=::60Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline.61Please see description of --sort in the perf-report man page.6263-t::64--field-separator=::6566Use a special separator character and don't pad with spaces, replacing67all occurrences of this separator in symbol names (and other output)68with a '.' character, that thus it's the only non valid separator.6970-v::71--verbose::72Be verbose, for instance, show the raw counts in addition to the73diff.7475-q::76--quiet::77Do not show any warnings or messages. (Suppress -v)7879-f::80--force::81Don't do ownership validation.8283--symfs=<directory>::84Look for files with symbols relative to this directory.8586-b::87--baseline-only::88Show only items with match in baseline.8990-c::91--compute::92Differential computation selection - delta, ratio, wdiff, cycles,93delta-abs (default is delta-abs). Default can be changed using94diff.compute config option. See COMPARISON METHODS section for95more info.9697--cycles-hist::98Report a histogram and the standard deviation for cycles data.99It can help us to judge if the reported cycles data is noisy or100not. This option should be used with '-c cycles'.101102-p::103--period::104Show period values for both compared hist entries.105106-F::107--formula::108Show formula for given computation.109110-o::111--order::112Specify compute sorting column number. 0 means sorting by baseline113overhead and 1 (default) means sorting by computed value of column 1114(data from the first file other base baseline). Values more than 1115can be used only if enough data files are provided.116The default value can be set using the diff.order config option.117118--percentage::119Determine how to display the overhead percentage of filtered entries.120Filters can be applied by --comms, --dsos and/or --symbols options.121122"relative" means it's relative to filtered entries only so that the123sum of shown entries will be always 100%. "absolute" means it retains124the original value before and after the filter is applied.125126--time::127Analyze samples within given time window. It supports time128percent with multiple time ranges. Time string is 'a%/n,b%/m,...'129or 'a%-b%,c%-%d,...'.130131For example:132133Select the second 10% time slice to diff:134135perf diff --time 10%/2136137Select from 0% to 10% time slice to diff:138139perf diff --time 0%-10%140141Select the first and the second 10% time slices to diff:142143perf diff --time 10%/1,10%/2144145Select from 0% to 10% and 30% to 40% slices to diff:146147perf diff --time 0%-10%,30%-40%148149It also supports analyzing samples within a given time window150<start>,<stop>. Times have the format seconds.nanoseconds. If 'start'151is not given (i.e. time string is ',x.y') then analysis starts at152the beginning of the file. If stop time is not given (i.e. time153string is 'x.y,') then analysis goes to the end of the file.154Multiple ranges can be separated by spaces, which requires the argument155to be quoted e.g. --time "1234.567,1234.789 1235,"156Time string is'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps157for different perf.data files.158159For example, we get the timestamp information from 'perf script'.160161perf script -i perf.data.old162mgen 13940 [000] 3946.361400: ...163164perf script -i perf.data165mgen 13940 [000] 3971.150589 ...166167perf diff --time 3946.361400,:3971.150589,168169It analyzes the perf.data.old from the timestamp 3946.361400 to170the end of perf.data.old and analyzes the perf.data from the171timestamp 3971.150589 to the end of perf.data.172173--cpu:: Only diff samples for the list of CPUs provided. Multiple CPUs can174be provided as a comma-separated list with no space: 0,1. Ranges of175CPUs are specified with -: 0-2. Default is to report samples on all176CPUs.177178--pid=::179Only diff samples for given process ID (comma separated list).180181--tid=::182Only diff samples for given thread ID (comma separated list).183184--stream::185Enable hot streams comparison. Stream can be a callchain which is186aggregated by the branch records from samples.187188COMPARISON189----------190The comparison is governed by the baseline file. The baseline perf.data191file is iterated for samples. All other perf.data files specified on192the command line are searched for the baseline sample pair. If the pair193is found, specified computation is made and result is displayed.194195All samples from non-baseline perf.data files, that do not match any196baseline entry, are displayed with empty space within baseline column197and possible computation results (delta) in their related column.198199Example files samples:200- file A with samples f1, f2, f3, f4, f6201- file B with samples f2, f4, f5202- file C with samples f1, f2, f5203204Example output:205x - computation takes place for pair206b - baseline sample percentage207208- perf diff A B C209210baseline/A compute/B compute/C samples211---------------------------------------212b x f1213b x x f2214b f3215b x f4216b f6217x x f5218219- perf diff B A C220221baseline/B compute/A compute/C samples222---------------------------------------223b x x f2224b x f4225b x f5226x x f1227x f3228x f6229230- perf diff C B A231232baseline/C compute/B compute/A samples233---------------------------------------234b x f1235b x x f2236b x f5237x f3238x x f4239x f6240241COMPARISON METHODS242------------------243delta244~~~~~245If specified the 'Delta' column is displayed with value 'd' computed as:246247d = A->period_percent - B->period_percent248249with:250- A/B being matching hist entry from data/baseline file specified251(or perf.data/perf.data.old) respectively.252253- period_percent being the % of the hist entry period value within254single data file255256- with filtering by -C, -d and/or -S, period_percent might be changed257relative to how entries are filtered. Use --percentage=absolute to258prevent such fluctuation.259260delta-abs261~~~~~~~~~262Same as 'delta` method, but sort the result with the absolute values.263264ratio265~~~~~266If specified the 'Ratio' column is displayed with value 'r' computed as:267268r = A->period / B->period269270with:271- A/B being matching hist entry from data/baseline file specified272(or perf.data/perf.data.old) respectively.273274- period being the hist entry period value275276wdiff:WEIGHT-B,WEIGHT-A277~~~~~~~~~~~~~~~~~~~~~~~278If specified the 'Weighted diff' column is displayed with value 'd' computed as:279280d = B->period * WEIGHT-A - A->period * WEIGHT-B281282- A/B being matching hist entry from data/baseline file specified283(or perf.data/perf.data.old) respectively.284285- period being the hist entry period value286287- WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option288behind ':' separator like '-c wdiff:1,2'.289- WEIGHT-A being the weight of the data file290- WEIGHT-B being the weight of the baseline data file291292cycles293~~~~~~294If specified the '[Program Block Range] Cycles Diff' column is displayed.295It displays the cycles difference of same program basic block amongst296two perf.data. The program basic block is the code between two branches.297298'[Program Block Range]' indicates the range of a program basic block.299Source line is reported if it can be found otherwise uses symbol+offset300instead.301302SEE ALSO303--------304linkperf:perf-record[1], linkperf:perf-report[1]305306307