Skip to content

Per-worker and per-submitter counters, accumulated since each participant joined. They complement the point-in-time snapshots of mizu_pool_info() and mizu_pool_dump(). Keeping them costs the pool nothing. The submitter counts are derived from the injection ring's own positions, so submission writes nothing extra, and the spill counter moves only on the spill path, where creating the region already costs far more than the counter update. The worker counters are kept in the worker process and mirrored into the region only when a worker parks, leaves, or passes its fairness tick, so under continuous load a worker's row can lag by up to 61 claims. The row is exact whenever that worker is parked or retired, or the pool is idle.

Usage

mizu_pool_stats(pool)

Arguments

pool

a pool handle from mizu_pool() or mizu_pool_attach(); inside a task, the evaluating worker's own handle from mizu_current_pool().

Value

A list of two data frames. workers: one row per worker slot, with status, pid, tasks (task evaluations run, help-mode and nested inline execution included), steals (entries claimed from the deques of peers), injections (entries claimed from injection rings), parks (kernel parks in the worker loop), helps (claims executed while blocked in a nested collect), and the current deque depth. submitters: one row per submitter slot, with status, pid, injected (entries ever published to its injection ring), claimed (entries the workers took from it), spills (payloads past the inline budget that traveled in their own region: task payloads at submit and result payloads at publish, both attributed to the submitter of the task; a nonzero value means slot_size is undersized for the traffic), spill_reuse (the subset of spills that recycled a retired region from the free list of the producer instead of creating one), and queued (injected - claimed). Steady-state spill traffic approaches spills, so spills - spill_reuse is the region-churn rate. Counters reset when a new joiner reuses a slot.

Examples

p <- mizu_pool()
t <- mizu_submit(p, runif(5))
mizu_collect(t)
#> [1] 0.8067468 0.9602766 0.7938457 0.7160383 0.1071536
mizu_pool_stats(p)
#> $workers
#>   slot status  pid tasks steals injections parks helps deque
#> 1    0   live 8172     1      0          1     1     0     0
#> 
#> $submitters
#>   slot status  pid injected claimed spills spill_reuse queued
#> 1    0   live 6700        1       1      0           0      0
#> 2    1   free    0        0       0      0           0      0
#> 3    2   free    0        0       0      0           0      0
#> 4    3   free    0        0       0      0           0      0
#> 5    4   free    0        0       0      0           0      0
#> 6    5   free    0        0       0      0           0      0
#> 7    6   free    0        0       0      0           0      0
#> 8    7   free    0        0       0      0           0      0
#> 
mizu_pool_stop(p)