Expand description
Stable Tokio runtime diagnostics (no tokio_unstable required).
Implements step 1 of the fast-Tokio principles: measure first. We capture
the stable subset of tokio::runtime::RuntimeMetrics — worker count,
alive tasks, global (injection) queue depth, and total worker busy time.
The article’s headline signal is the global queue staying deep (“in a
healthy application it should generally stay close to empty”); that metric
is stable, so it ships here.
Per-worker local-queue depth, steal/overflow counts, blocking-pool depth,
and the poll-time/schedule-latency histograms are all gated behind
RUSTFLAGS="--cfg tokio_unstable" in current Tokio. Enabling that cfg
changes the whole dependency graph build, so it stays opt-in follow-up work
rather than a default here.
Structs§
- Runtime
Snapshot - Snapshot of stable runtime counters at one instant.
Functions§
- configured_
worker_ threads - Resolve an explicit worker-thread count for the main runtime.
- log_
snapshot - Log one snapshot at
DEBUGlevel; no-op unless diagnostics are enabled. - runtime_
diagnostics_ enabled - Returns true when runtime diagnostics logging is enabled.
- snapshot
- Capture stable counters from a runtime handle.
- spawn_
periodic_ reporter - Spawn a low-frequency reporter for long-lived processes.