gcWindowStats property

({int events, int markStarts, int old, bool pauseAvailable, double? pauseMs, int young}) get gcWindowStats

GC events in the current 10 s window, by class, and their summed pause time.

pauseAvailable is true only when every event in the window has a measured pause. pauseMs is null whenever it is false, so "no pauses" (0.0) and "not measurable" stay distinct.

Implementation

({
  int events,
  int young,
  int old,
  int markStarts,
  bool pauseAvailable,
  double? pauseMs,
})
get gcWindowStats {
  final cutoff = _clock().subtract(_gcWindowDuration);
  final window = [
    for (final r in _gcWindow)
      if (!r.ts.isBefore(cutoff)) r,
  ];
  final pauseMs = _windowPauseMs(window);
  return (
    events: window.length,
    young: window.where((r) => r.gcClass == _GcClass.young).length,
    old: window.where((r) => r.gcClass == _GcClass.old).length,
    markStarts: window.where((r) => r.gcClass == _GcClass.markStart).length,
    pauseAvailable: pauseMs != null,
    pauseMs: pauseMs,
  );
}