Skip to main content

Module boot_timing

Module boot_timing 

Source
Expand description

Per-step timing for srv’s boot path, logged once as a single summary line when AGENTMUXSRV-ESTART is emitted.

WHY. docs/specs/SPEC_FAST_STARTUP_UPGRADE_OWNS_MIGRATIONS_AND_UPDATES_2026_09_15.md §3 inventories the boot path and finds several passes that run on every boot and have never been individually timed — the registry session_id catch-up backfill, the transcript backfill, the snapshot-source gap repair, and the agent auto-seed. The splash’s backend stage reports one number covering all of them together, so there is currently no way to say which of them (if any) is worth moving off the critical path. §6 of that spec asks for measurement before relocation; this is the instrument.

Deliberately tracing, not the srv_stderr splash protocol (agentmux_common::srv_stderr) the per-migration rows use: the direction of travel is fewer splash rows, not more (docs/reports/REPORT_SPLASH_MIGRATION_ROW_OVERFLOW_AND_SUMMARY_2026_09_15.md), and these numbers are for whoever is profiling a boot, not for the user watching one. Read them with muxlog srv grep boot_timing.

The global recorder is a process-lifetime singleton because the steps it wraps are scattered through the long boot functions in crates/srv/src/bootstrap/stores.rs and crates/srv/src/main.rs; threading a &mut BootTimings through all of them would be a much larger diff than the measurement is worth. BootTimings itself is a plain value type with no global state, which is what the tests below exercise.

Structs§

BootTimings
One boot’s worth of step timings.

Functions§

init
Start timing this boot. Called once from main, after logging is up.
log_summary
Log the one summary line. Called once, where the boot path ends.
recorder 🔒
time
Run f, recording its duration under step if init has been called.
time_async
time, for an async step. Same no-lock-across-the-work property.