Linux Audio Latency: How to Measure It
Use cyclictest to measure how late a test thread wakes, pw-top to diagnose a PipeWire graph, and a physical loopback to measure the delay through an audio interface. None of those results substitutes for the others. If your immediate goal is to stop glitches, start with the practical low-latency setup.
| Question | Record | Does not establish |
|---|---|---|
| How late can a test thread wake under this load? | cyclictest wake-up delay in microseconds | The delay through an audio interface |
| Does the graph finish its work in time? | Observed period, load ratios and new errors in pw-top | A physical loopback delay or an exact count of audible glitches |
| How long does this routed signal take to return? | Loopback offset in samples and milliseconds | Which thread or buffer caused the delay |
1. Measure scheduler wake-up delay
On a Linux test machine, use your distribution’s rt-tests package and check man cyclictest for the installed version. Run a short baseline away from a live recording or performance. This example requests a 1,000 µs wake-up interval and prints a summary after 60 seconds:
uname -r
cyclictest --help
cyclictest --duration=60 --interval=1000 --quietCheck that the run completes and record any privilege or scheduling warnings. If the tool requires real-time permissions, follow your distribution’s guidance for a test machine; do not silently change privileges or priority between runs. Keep the actual priority, policy, interval and CPU affinity the same for a comparison. Repeat with a representative workload and record elapsed time and the worst observed wake-up delay in microseconds. A short run is a diagnostic sample, not a maximum your system guarantees.
Save the original summaries from at least two equivalent runs before changing anything. Check the thread identifier, units and minimum, average and maximum values rather than copying only the average. If the version supports histograms, record the distribution and overflow counts too. A smaller average alongside an unchanged or worse tail is not an improvement if the fault you are investigating is a rare stall. Write down whether Wi-Fi, storage and other usual session loads were active rather than comparing a busy laptop with an otherwise idle one.
2. Check graph timing and XRUNs
In PipeWire, find the driver and the application beneath it in pw-top. Record the driver’s QUANT and RATE, then look for new ERR increments during the workload. At 128 frames and 48 kHz, one nominal period is about 2.67 ms. It is not the delay from microphone to headphones. If that graph is missing deadlines, use the PipeWire buffer test and calculator to change one variable and retest.
Note the affected driver before and after reopening the device. A counter reset or changed node is a new baseline, not a negative count of glitches. Watch what happens when the workload starts and stops rather than trying to infer a fault from a suspended node. If the same plugin consistently pushes processing time up, bypass it and repeat the passage with rate, quantum and routing unchanged.
3. Measure physical round-trip latency
Turn monitoring and feedback paths off, bring levels down and connect a suitable line output to a line input. Send and record a test pulse, then measure the sample offset between the original and return. Divide by the sample rate and multiply by 1,000 for milliseconds. Document the backend, actual periods and any latency compensation; disable compensation that shifts the recorded return or use a dedicated loopback tool. Repeat measurements without changing the physical path.
For example, an offset of 384 samples at 48 kHz would be 8 ms. That is a worked conversion, not a result for a particular interface. An analogue loopback includes the converter and physical ports used in the test. An internal return may bypass both. Do not compare a graph-only loopback on one device with a cabled analogue return on another, or silently combine DAW-compensated offsets with uncompensated timings.
If wake-ups look good but the graph reports new errors, investigate graph load and device behaviour before switching kernels. If the graph is stable but monitoring feels late, check the physical route and plugin delay instead.
Linux 2.4-era result pages
These URLs preserve historical configuration labels. They do not contain verified raw traces and are not evidence about current kernels.
- 2.4.0-test6-preemp-rtsched, 2,048-sample label
- 2.4.0-test6-preemp, 2,048-sample label
- 2.4.0-test7-lowlatency-A0, 2,048-sample label
HDRBench belongs to a different category: it tested simultaneous multitrack disk recording and playback, not timer wake-up or physical round-trip audio delay. Keep storage throughput separate even if a storage stall can cause a dropout in a real project.
For a separate creative workflow rather than a latency test, see the best AI audio tools guide.