Skip to main content

Module stall_watch

Module stall_watch 

Source
Expand description

A watch on srv’s async runtime: it says in the log when the runtime stops running tasks, and for how long.

A task on the runtime beats every Config::beat_every; an OS thread outside the runtime looks at the beat every Config::poll_every. A beat that is Config::stall_after or more behind, or a look that itself comes that much late (the process was paused and the beat ran again before the look did), starts a stall, which ends when beats are on time again and stay so for Config::merge_gap (a stall that returns within that gap is the same stall). One line is written when it starts and one when it ends, whatever its length, each beginning with PREFIX:

runtime-stall: start late_ms=1830 cause=runtime workers=8 alive_tasks=412 queue=17 load1=3.2
runtime-stall: start late_ms=1830 cause=runtime workers=32 alive_tasks=412 queue=0 over_ms=2000 cpu_machine=94 cpu_srv=2 io_read_mb=0 io_write_mb=3 mem_load=58
runtime-stall: end lasted_ms=5300 worst_late_ms=5200 stalls=2

cause=machine says the watching thread was itself late (the machine was suspended or had no CPU for srv); cause=runtime says only the runtime was, which is a blocked worker or a task that did not yield, or a machine that did not schedule srv’s workers while it kept the watching thread’s sleep honest. The cpu_ and io_ figures (Windows, stall_load) say which: the share of all cores the machine used and srv used over the last two seconds, srv’s reads and writes in MB, and how full memory was. A machine at 95% and srv at 2% is a machine with no CPU for srv; both low is a blocked worker.

Structs§

Config
Snapshot
What the runtime looked like when a stall was noticed.

Enums§

Event

Constants§

PREFIX
Every line this watch writes starts with it, so a log search finds them all.

Functions§

record_fields
The record’s line for a stall that ended: how long it lasted, its worst lateness, how many stalls were merged into it, and whether the machine (not the runtime) was the cause. Numbers and a name only.
start
Start the watch on the current runtime, writing its lines to the log and each stall that ended to the record (agentmux_common::record_events: a stall of a month ago is as findable as one of a minute ago).
watch
Watch runtime with cfg, calling on_event from the watching thread.