Documentation
¶
Overview ¶
Package loadgate reads the machine's load averages and refuses a measurement taken on a busy machine.
⛔ WHY A GATE AND NOT A NOTE. This fleet's standing rule is "never measure at a 1-minute load above ~8", and on 2026-11-16 it was broken by the session that had written a gate for it the day before. That gate (go-tex/engine's cmd/internal/loadguard) covers the two corpus tools and nothing else, so `go test -bench` — the measurement actually taken — was guarded by nothing.
⛔⛔ AND THE DAMAGE WAS A RATIO, WHICH IS THE CASE THAT LOOKS SAFE. The figure published was a SHARE: a serial suite on one side, a benchmark on the other, both taken in the same session, which feels like it should cancel. It does not. Retaken on a quiet machine:
loaded quiet factor suite, 2012 tests, serial 58.04 s 17.76 s ×3.3 BenchmarkLoadLaTeX 3.658 ms 2.621 ms ×1.4 the share they make "12.7%" 29.7%
The wall clock stretches far more than a tight in-process loop, so the RATIO moves by more than either half. The wrong figure was published as a refutation of a colleague's finding, and it ruled out the candidate that was right.
⚠ DUPLICATION, SAID OUT LOUD. go-tex/engine's cmd/internal/loadguard is the same sixty lines with the same threshold. Two copies of one rule is what this fleet's own mandate forbids, and neither can import the other: both are `internal`. Raised as its own question rather than resolved here by making a third copy — see the pull request that added this package.
Index ¶
Constants ¶
const Threshold = 8.0
Threshold is the load average above which this fleet does not measure.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Averages ¶
type Averages struct {
One, Five, Fifteen float64
}
Averages are the three load averages, as uptime reports them.
func Check ¶
Check reports whether a measurement may proceed, returning the averages so the caller can print them WITH its result: the conditions belong in the report, not in the operator's memory.
⚠ BOTH the 1-minute AND the 5-minute average must be under the threshold. A 1-minute dip under a loaded 5-minute average is not a quiet machine, and reading only the first minute passed a run at 1-min 6.93 with a 5-min of 10.00.
⛔ An unreadable machine is refused, not waved through. override is a REASON, never a boolean, and the caller stamps it into the output.
func Read ¶
Read returns the machine's load averages.
Linux exposes them in /proc/loadavg; macOS does not, so sysctl is asked for vm.loadavg. ⛔ A platform where neither works returns an ERROR rather than a zero Averages: zero would read as an idle machine, and this fleet has paid for a scan that could not read reporting zero.