Skip to main content

Module runtime_diagnostics

Module runtime_diagnostics 

Source
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§

RuntimeSnapshot
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 DEBUG level; 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.