FrameTimeRecorder class
Reduces a stream of engine frame timings to rolling build/raster/total percentiles.
Deliberately does not call SchedulerBinding.instance.addTimingsCallback
itself, and does not import package:flutter/scheduler.dart at all --
the caller (a benchmark runner driving a real device, or a test feeding
hand-built timings) owns that subscription and its lifetime. This class
only owns the arithmetic, which is what makes it testable with synthetic
data: ui.FrameTiming has a public constructor that exists specifically
for tests (see its own doc comment), so recordFrameTimings can be fed a
known distribution and the percentiles that come back can be asserted
exactly -- no widget pumped, no device involved, no raster thread ever
runs.
Constructors
- FrameTimeRecorder({int windowSize = 1000})
- Creates a recorder.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleCount → int
-
How many frames are currently held in the window.
no setter
- windowSize → int
-
The maximum number of recent frames retained per metric.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordFrameTimings(
List< FrameTiming> timings) → void -
Feeds a batch of engine-reported timings, in the same shape
SchedulerBinding.addTimingsCallbackdelivers them. -
reset(
) → void - Clears every recorded sample.
-
summarize(
{required String sceneId, String? notes}) → BenchmarkFrameReport - Reduces the current window to a report.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited