xrefcode.com / docs / cli / profile-annotate
$ xref profile annotate
On this page
Show where inside one function the samples fell: its disassembly (or pseudo-C with --c) with each line's share of the function and of the whole profile.
Usage
xref profile annotate [OPTIONS] <PROFILE> <FUNCTION>
Arguments and options
Arguments
<PROFILE>The
.xprof recording.<FUNCTION>Function address or symbol name.
Options
--cAnnotate pseudo-C lines instead of assembly.
--jsonPrint the annotation as JSON.
--min-samples <MIN_SAMPLES>Omit rows with fewer samples than this threshold.
--percent <PERCENT>Which shares to print: of the function, of the whole profile, or both [possible values: both, function, profile].
Examples
The profile is ripgrep filtering an endless input stream, recorded with live profile.
Hot instructions of one function
Only rows with at least one sample:
Command
$ xref -b rg profile annotate rg.xprof 0x10b0c0 --min-samples 1
Output
100.00% function 11.56% profile 925 0x10b1fa mov [rbx+0x10], rax
stderr
xref: load 2.6ms, total 21.9ms
Reading the output
- Each row: the share of the function's samples, the share of the whole profile, the sample count, the address and the instruction. Samples land on the instruction the CPU reported, which is often the one after a slow load (skid).
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-annotate.md · generated for the site; edit the Markdown, not this page.