Skip to main content

Module quiet_ledger

Module quiet_ledger 

Source
Expand description

The longest quiet gap of every Git step and tool this process ran, kept until a timing record takes it. What: The longest quiet gap of every Git step and every tool this process ran, kept until a timing record takes it. A quiet gap is a stretch in which the step showed no sign of work: no bytes moved, no processor time, no task running or waiting for the disk (the signs of push_progress.rs). Why: A step ends only when it has been quiet for a window, so the window must be set above the longest gap a healthy step shows (doc/planning/cli-git-shipped-limits-audit.md, “Time limits on Git child steps of a commit”). Nothing logged a gap before this, only whole times, and a whole time is an upper bound of the gap, never the gap. The timing records (commit_timing.rs, add_timing.rs) take the figures when they are written, so a measurement comes from the runs the person’s own work makes. A step that was ended for being quiet is kept apart from the steps that ended by themselves, because only the steps that ended by themselves show how quiet a healthy step gets.

In TS you’d write (pseudocode):

const gaps = new Map<string, number>();
export const note = (step: string, gapMs: number, ended: boolean) => gaps.set(key(step, ended), Math.max(gaps.get(key(step, ended)) ?? 0, gapMs));
export const drain = () => { const all = [...gaps]; gaps.clear(); return all; };

Constants§

ENDED_SUFFIX
The suffix of a step name whose run was ended for being quiet, so it never mixes with the steps that ended by themselves.

Functions§

drain
What: Take every figure kept and forget them, in the order of the step names. Why: One record takes the figures of the command it describes; the next command starts from nothing.
longest_healthy
What: The longest gap among the steps that ended by themselves, in milliseconds, or zero when none ran. Why: One number answers “how quiet did a healthy step get in this command” without reading the object.
note
What: Keep gap as the longest quiet gap of step when it is longer than the one kept. Why: A step runs many times in one command; the longest of them is the figure an interval has to clear.
object_json
What: The figures as a JSON object from step name to milliseconds. Why: Both timing records carry it under one key, so a reader asks one question of both files.