TimeManager
struct · core · 2016 bytes
- Meaning
- Holds the calibration state of the clock: scale, offset, thread, samples and rate estimates
- 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.
Fields 10
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 8 | double | m_secondsPerTick | Holds the seconds per counter tick, 0.001 at construction | verified, proof one | core/time#counter-switch |
0x0008 | 8 | double | m_offsetSeconds | Holds the offset in seconds, 0 at construction | verified, proof one | core/time#counter-switch |
0x0010 | 4 | void * | m_thread | Holds the calibration thread's handle | verified, proof one | core/time#time-manager-lifetime |
0x0014 | 4 | void * | m_stopEvent | Holds the manual-reset event that stops the calibration thread | verified, proof one | core/time#time-manager-lifetime |
0x0018 | 4 | uint32_t | m_interval | Holds the calibration interval in milliseconds, 250 | verified, proof one | core/time#calibration-thread |
0x001c | 4 | uint32_t | m_processors | Holds the processor count | verified, proof one | core/time#multi-core-gate |
0x0020 | 4 | uint32_t | m_multiCore | Holds the multi-core bit; nonzero stops counter switching | verified, proof one | core/time#multi-core-gate |
0x0028 | 1936 | uint8_t[1936] | m_samples | Holds 121 samples of 16 bytes: counter low and high dwords, GetTickCount, padding | verified, proof one | core/time#calibration-thread |
0x07b8 | 4 | uint32_t | m_sampleIndex | Holds the index of the newest sample | verified, proof one | core/time#calibration-thread |
0x07c0 | 32 | uint64_t[4] | m_estimates | Holds the counter rate estimates over 1, 4, 20 and 120 samples | verified, proof one | core/time#calibration-thread |