PERF-DIFF(1)
π
PERF-DIFF(1) β the one where we read two perf.data files and drag them π
ok so bestie, welcome to perf-diff, aka the manual page for perf diff (that's PERF-DIFF(1) in manpage-speak, mwah). Buckle up, this one's actually kind of iconic.
β¨ NAME β¨
perf-diff β read perf.data files and display the differential profile π¦
πΈ SYNOPSIS πΈ
perf diff [baseline file] [data file1] [[data file2] ... ]
π DESCRIPTION π
okay so real talk: this command displays the performance difference amongst two or more perf.data files captured via perf record. like, it literally diffs your profiles and shows you what changed. slay.
if no parameters are passed it will assume perf.data.old and perf.data. yes, it just assumes, main character energy fr.
the differential profile is displayed only for events matching both specified perf.data files. so no overlap, no entry. vibe check failed, entry not admitted π
if no parameters are passed the samples will be sorted by dso and symbol. here's the thing though β the perf.data files could come from different binaries, so the symbol addresses could vary. π so perf diff is based on the comparison of the files and symbols name. names not addresses, iykyk.
π OPTIONS π
-D,--dump-raw-traceβ dump the raw trace in ASCII. raw. unfiltered. just how we like it β¨--kallsyms=<file>β kallsyms pathname. that's it, that's the whole thing π«Ά-m,--modulesβ load module symbols. β οΈ WARNING: use only with-kand LIVE kernel. like, do not play with this one bestie, it says so right there.-d,--dsos=β only consider symbols in these dsos. it's a CSV that understandsfile://filenameentries. heads up: this option will affect the percentage of the Baseline/Delta column β see--percentagefor more info π-C,--comms=β only consider symbols in these comms. CSV that understandsfile://filenameentries. also affects the percentage of the Baseline/Delta column β see--percentagefor more info π-S,--symbols=β only consider these symbols. CSV that understandsfile://filenameentries. and yeah, this one affects the percentage of the Baseline/Delta column too β see--percentagefor more info π-s,--sort=β sort by key(s):pid,comm,dso,symbol,cpu,parent,srcline. please see the description of--sortin theperf-reportman page, ok? go read it, i'll wait π§-t,--field-separator=β use a special separator character and don't pad with spaces, replacing all occurrences of this separator in symbol names (and other output) with a.character, that thus it's the only non valid separator. periodt.-v,--verboseβ be verbose. for instance, show the raw counts in addition to the diff. like yes, give me everything π₯-q,--quietβ do not show any warnings or messages. (Suppress-v.) silence is golden πΈ-f,--forceβ don't do ownership validation. living dangerously, love that for you π--symfs=<directory[,layout]>β look for files with symbols relative to this directory. the optional layout can behierarchy(default, matches full path) orflat(only matches base name). this is useful when debug files are stored in a flat directory structure. lowkey a lifesaver π«Ά-b,--baseline-onlyβ show only items with match in baseline. exclusive vibes β¨-c,--computeβ differential computation selection βdelta,ratio,wdiff,cycles,delta-abs(default isdelta-abs). the default can be changed using thediff.computeconfig option. see the COMPARISON METHODS section for more info π--cycles-histβ report a histogram and the standard deviation forcyclesdata. it can help us to judge if the reported cycles data is noisy or not. this option should be used with-c cycles. π€-p,--periodβ show period values for both compared hist entries. both. not one. both π«-F,--formulaβ show formula for given computation. show me the math, king π-o,--orderβ specify compute sorting column number.0means sorting by baseline overhead and1(default) means sorting by computed value of column 1 (data from the first file other base baseline). values more than1can be used only if enough data files are provided. the default value can be set using thediff.orderconfig option. ποΈ--percentageβ determine how to display the overhead percentage of filtered entries. filters can be applied by--comms,--dsosand/or--symbolsoptions.
"relative" means it's relative to filtered entries only so that the
sum of shown entries will be always 100%. "absolute" means it retains
the original value before and after the filter is applied.
--timeβ analyze samples within given time window. it supports time percent with multiple time ranges. time string isa%/n,b%/m,...ora%-b%,c%-%d,....
for example:
select the second 10% time slice to diff:
perf diff --time 10%/2
select from 0% to 10% time slice to diff:
perf diff --time 0%-10%
select the first and the second 10% time slices to diff:
perf diff --time 10%/1,10%/2
select from 0% to 10% and 30% to 40% slices to diff:
perf diff --time 0%-10%,30%-40%
it also supports analyzing samples within a given time window <start>,<stop>. times have the format seconds.nanoseconds. if 'start' is not given (i.e. time string is ',x.y') then analysis starts at the beginning of the file. if stop time is not given (i.e. time string is 'x.y,') then analysis goes to the end of the file. multiple ranges can be separated by spaces, which requires the argument to be quoted e.g. --time "1234.567,1234.789 1235,". time string is 'a1.b1,c1.d1:a2.b2,c2.d2'. use ':' to separate timestamps for different perf.data files. π°οΈ
for example, we get the timestamp information from perf script.
perf script -i perf.data.old
mgen 13940 [000] 3946.361400: ...
perf script -i perf.data
mgen 13940 [000] 3971.150589 ...
perf diff --time 3946.361400,:3971.150589,
it analyzes the perf.data.old from the timestamp 3946.361400 to the end of perf.data.old and analyzes the perf.data from the timestamp 3971.150589 to the end of perf.data. no cap, that's what it does π¦
--cpuβ only diff samples for the list of CPUs provided. multiple CPUs can be provided as a comma-separated list with no space:0,1. ranges of CPUs are specified with-:0-2. default is to report samples on all CPUs. π»--pid=β only diff samples for given process ID (comma separated list). π--tid=β only diff samples for given thread ID (comma separated list). π--streamβ enable hot streams comparison. stream can be a callchain which is aggregated by the branch records from samples. π
π COMPARISON π
okay so the comparison is governed by the baseline file. the baseline perf.data file is iterated for samples. all other perf.data files specified on the command line are searched for the baseline sample pair. if the pair is found, specified computation is made and result is displayed. π€
all samples from non-baseline perf.data files that do not match any baseline entry are displayed with empty space within the baseline column and possible computation results (delta) in their related column. so like, they show up, but they're sitting at the cool kids' table with an empty chair next to them π
example files samples: - file A with samples f1, f2, f3, f4, f6 - file B with samples f2, f4, f5 - file C with samples f1, f2, f5
example output: x - computation takes place for pair b - baseline sample percentage
perf diff A B C
baseline/A compute/B compute/C samples
---------------------------------------
b x f1
b x x f2
b f3
b x f4
b f6
x x f5
perf diff B A C
baseline/B compute/A compute/C samples
---------------------------------------
b x x f2
b x f4
b x f5
x x f1
x f3
x f6
perf diff C B A
baseline/C compute/B compute/A samples
---------------------------------------
b x f1
b x x f2
b x f5
x f3
x x f4
x f6
π§ COMPARISON METHODS π§
β delta
if specified the Delta column is displayed with value d computed as:
d = A->period_percent - B->period_percent
with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively.
period_percentbeing the % of the hist entry period value within single data file- with filtering by
-C,-dand/or-S,period_percentmight be changed relative to how entries are filtered. use--percentage=absoluteto prevent such fluctuation. β οΈ
β delta-abs
same as delta method, but sort the result with the absolute values. it's giving "I don't care about the sign, I care about the drama" π
β ratio
if specified the Ratio column is displayed with value r computed as:
r = A->period / B->period
with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively.
periodbeing the hist entry period value
β wdiff:WEIGHT-B,WEIGHT-A
if specified the Weighted diff column is displayed with value d computed as:
d = B->period * WEIGHT-A - A->period * WEIGHT-B
A/Bbeing matching hist entry from data/baseline file specified (orperf.data/perf.data.old) respectively.periodbeing the hist entry period valueWEIGHT-A/WEIGHT-Bbeing user supplied weights in the-coption behind:separator like-c wdiff:1,2.WEIGHT-Abeing the weight of the data fileWEIGHT-Bbeing the weight of the baseline data file
β cycles
if specified the [Program Block Range] Cycles Diff column is displayed. it displays the cycles difference of same program basic block amongst two perf.data. the program basic block is the code between two branches. πΏ
[Program Block Range] indicates the range of a program basic block. source line is reported if it can be found otherwise uses symbol+offset instead. π₯
π«Ά SEE ALSO π«Ά
perf-record(1), perf-report(1)
ok that's the whole page bestie, go forth and diff π this gem is from the perf manual, dated 10/31/2026, and you can find it filed under PERF-DIFF(1). bye ily πβ¨
π¦ where this page comes from
- arch rolling: perf 7.3.1-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms