Menu

Reference / Async

stats()

function
function stats(): array

Engine counters.

Monotonic totals (spawned, settled, cancelled, wakes, reactor_waits, timer_fires, watchdog, offloaded), the blocking-pool size (pool_threads) and the current gauges (live, ready, io_parked, timers). Useful for benchmarks and for asserting engine behaviour in a test, e.g. that a run did not silently fall back to polling, or that the watchdog fired exactly once. live is the gauge to alert on when tasks pile up.

Returns

array<string,int> — the counters by name; empty outside a running engine

See also: dump

View source