XRef
Documentation menu
xrefcode.com / docs / cli / profile-annotate

$ xref profile annotate

On this page
  1. Usage
  2. Arguments and options
  3. Examples
  4. Hot instructions of one function
  5. Reading the output
  6. Provenance

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

--c
Annotate pseudo-C lines instead of assembly.
--json
Print the annotation as JSON.
--min-samples <MIN_SAMPLES>
Omit rows with fewer samples than this threshold.
default 0
--percent <PERCENT>
Which shares to print: of the function, of the whole profile, or both [possible values: both, function, profile].
default both

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

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.