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§
- Boot
Timings - One boot’s worth of step timings.
Constants§
- SLOW_
STEP - How long a
step_if_slowruns before it is worth a splash row.
Traits§
- Step
Outcome - Whether a
step’s result means it worked, so a failed step’s end line says so and the splash shows it failed, not done.
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.
- step
- A data-preparation step the splash shows: copying the previous version’s
data, a snapshot, the backup. Writes
AGENTMUXSRV-STEP-BEGIN/-ENDon stderr aroundf(the launcher shows a sub-row of “Backend startup”; the same lines reportagentmux-srv migrate --prepare’s steps) and records the time liketime, so the splash and the boot summary come from one call. - step_
if_ slow - A
stepthat is usually instant and only sometimes waits (another process’s migration lock): its begin line is written once it has run forSLOW_STEP, while it is still running, and then its end line with the outcome. A fast one writes nothing. - time
- Run
f, recording its duration understepifinithas been called. - time_
async time, for an async step. Same no-lock-across-the-work property.