measuredCadenceHz property

double? get measuredCadenceHz

Vsync cadence estimated from the 10th percentile of recent vsyncStart deltas, or null until 30 valid deltas have been seen.

The 10th percentile, not the median: fast frames reveal the vsync period, while slow frames are the thing being measured. A median would absorb steady jank into the cadence and loosen the budget it is judged against. Deltas <= 0 and idle gaps longer than two fpsTarget frames are ignored. The last 120 valid deltas are kept.

Implementation

double? get measuredCadenceHz {
  if (_cadenceCount < _cadenceMinSamples) return null;
  if (_cadenceDirty) {
    final sorted = _cadenceDeltas.sublist(0, _cadenceCount)..sort();
    final p10 = sorted[(_cadenceCount * 0.1).floor()];
    _cachedCadenceHz = 1e6 / p10;
    _cadenceDirty = false;
  }
  return _cachedCadenceHz;
}