Skip to main content

Module prof

Module prof 

Source
Expand description

Feature-gated encode/decode stage profiler — the instrument for perf work.

Zero cost unless the profile cargo feature is enabled: with it off, scope is a no-op returning a ZST guard the optimizer elides entirely, so release builds are byte-identical and the hot path is untouched. With it on, each stage times itself into an atomic tick bucket; dump prints the per-stage breakdown and snapshot returns a calibrated reading so a driver can run many passes and take per-stage medians.

Design mirrors rusty_h264-common/src/prof.rs (rdtsc ticks + wall-clock anchor calibration). A Stage::Total scope wraps OpusEncoder::encode(); the mgmt/other line is the residue (Total − Σ stages) — decompose it until every line is named, or prove it equals the timer overhead (Σ calls × ~2 × tick cost).

Structs§

Guard
No-op guard (ZST) — elided in release.

Enums§

Stage
A timed pipeline stage. Order matters: everything before Total is a sub-component summed for the mgmt/other residue.

Constants§

INFO_FIRST
Index of the first info-tier stage — buckets INFO_FIRST..Total are nested diagnostics excluded from the mgmt/other residue sum.
N
Number of buckets.

Functions§

dump
name
reset
scope
snapshot