summarize method

BenchmarkFrameReport summarize({
  1. required String sceneId,
  2. String? notes,
})

Reduces the current window to a report.

Throws StateError if nothing has been recorded yet -- see FrameTimeStats.of's own reasoning for why an empty window must never silently become a zero-cost report.

Implementation

BenchmarkFrameReport summarize({required String sceneId, String? notes}) {
  if (_total.isEmpty) {
    throw StateError(
      'FrameTimeRecorder.summarize() was called for "$sceneId" with zero '
      'frames recorded. A report built from no samples is not a '
      'measurement of "nothing costs anything" -- it is silence dressed '
      'up as a result. Make sure the scene actually produced frames '
      'while this recorder was listening.',
    );
  }
  return BenchmarkFrameReport(
    sceneId: sceneId,
    runMode: BenchmarkRunMode.current(),
    build: FrameTimeStats.of(_build),
    raster: FrameTimeStats.of(_raster),
    total: FrameTimeStats.of(_total),
    notes: notes,
  );
}