Skip to main content

Module latency_analyzer

Module latency_analyzer 

Source
Expand description

Low-level benchmark utility for measuring DSP processor CPU cost.

LatencyAnalyzer provides the timing primitives used by AudioLatencyMeasurementService to derive per-processor execution costs. It is intentionally a pure measurement tool with no knowledge of audio routing or the service layer.

§Methodology

Both functions run the processor (or a zero-work passthrough) over iterations × block_size samples, alternating between +0.5 and -0.5 inputs to exercise any branch-dependent code paths. std::hint::black_box is used on each output to prevent the compiler from optimising the loop body away.

The net cost reported by measure_effect_added_execution_us is:

net_us_per_sample = max(effect_us_per_sample − passthrough_us_per_sample, 0)

Clamping to ≥ 0 prevents occasional negative readings caused by CPU scheduling noise on the passthrough run.

Structs§

LatencyAnalyzer
Stateless benchmark utility for measuring DSP processor CPU execution cost.