benilla-re systems structs docs

CalibrateClockCounter

function · core · primitive

Address
0x42ba90 · 1374 bytes, up to 0x42bfed
Meaning
Samples every 250 ms, estimates the counter rate over four spans and switches the counter
Confidence
verified, proof one
Finding
core/time#calibration-thread

Finding: Calibration thread in core: time

The time manager starts a thread, OsTime, which samples the counter and GetTickCount every 250 ms into a ring of 121 samples and estimates the counter's rate over 1, 4, 20 and 120 samples. It picks the shortest span whose estimate strays from the stored rate beyond its tolerance, capped where neighbouring estimates disagree. In mode 0, a pick of the 20- or 120-sample span, or none, stores the 120-sample estimate and switches to mode 1; a 1- or 4-sample pick stores that estimate and stays. In mode 1 a pick stores its estimate and rescales, and returns to mode 0 when the short-span estimates disagree. The switch is not one-way.

The derivation is in the doc.

Callers 1

Callees 7

Calls and jumps by a bare address, from tables/calls.tsv.