xrefcode.com / docs / cli / profile-diff
$ xref profile diff
On this page
Compare two profiles by sample share: which functions got hotter or cooler. Two recordings of the same binary are compared function by function; with --other NEW_BINARY the second profile is of another build, and functions are paired with match (heuristic, and marked as such).
Usage
xref profile diff [OPTIONS] <BEFORE> <AFTER>
Arguments and options
Arguments
<BEFORE>The earlier
.xprof recording.<AFTER>The later
.xprof recording.Options
--other <OTHER>Binary AFTER was recorded from, when it is another build; functions are then paired heuristically.
--top <TOP>Number of rows to print.
--jsonPrint the comparison as JSON.
--by <BY>What a row aggregates [possible values: function].
--min-delta <MIN_DELTA>Omit rows whose share changed by fewer percentage points than this.
Examples
Two recordings of the same process
Two one-second live profile recordings of the same ripgrep process:
Command
$ xref -b rg profile diff rg.xprof rg-2.xprof --top 6
Output
sample-share delta; cross-build pairs are heuristic; shared modules omitted +1.12% 0x42f380 -> 0x42f380 [same_image] -0.71% 0x4302b0 -> 0x4302b0 [same_image] +0.43% 0x430060 -> 0x430060 [same_image] -0.13% 0x4752a0 -> 0x4752a0 [same_image] -0.11% 0x4307b0 -> 0x4307b0 [same_image] -0.09% 0x10b0c0 -> 0x10b0c0 [same_image]
stderr
xref: load 2.4ms, total 31.7ms
Reading the output
- Each row: the change in sample share, the function in the first and the second profile (
-when one side has no counterpart), and how they were paired:same_image,heuristic(cross-build match) orunmatched. - Shares are normalized by each profile's sample count, so recordings of different lengths compare directly. Small deltas between two runs of the same workload, as here, are sampling noise.
Provenance
Recorded with a development build of xref after 0.4.0 on Linux x86-64, on rg = ripgrep 14.1.1 (official stripped release). Output is unchanged except that whitespace at the end of each line and empty lines at the end of the output are removed; long outputs are cut where marked.
Source: docs/cli/profile-diff.md · generated for the site; edit the Markdown, not this page.