averageFps property

double get averageFps

Rolling average FPS based on recent frame durations.

Implementation

double get averageFps {
  if (_recentFrameDurations.isEmpty) return 0;
  final totalMicroseconds = _recentFrameDurations.fold<int>(
    0,
    (sum, d) => sum + d.inMicroseconds,
  );
  final avg = totalMicroseconds / _recentFrameDurations.length;
  if (avg <= 0) return 0;
  return 1000000.0 / avg;
}