CockpitPerformanceCollector class final

Collects engine-reported frame timings for an explicit, bounded capture.

The collector is dormant until start is called. It never samples the widget tree and does not enable VM timeline streams by itself. This keeps the normal application path cheap; callers that need VM events should use flutter_cockpit_test's profiling API, which owns the official integration test VM-service trace lifecycle.

Constructors

CockpitPerformanceCollector({CockpitPerformanceMode mode = CockpitPerformanceMode.light, int maxFrames = 100000, int? frameBudgetUs, DateTime now()?, String? platform, String? buildMode})

Properties

buildMode String
final
frameBudgetUs int
no setter
frameCount int
no setter
hashCode int
The hash code for this object.
no setterinherited
invalidFrameCount int
no setter
isRunning bool
no setter
maxFrames int
final
mode CockpitPerformanceMode
final
platform String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startedAt DateTime?
no setter

Methods

addFrameListener(CockpitPerformanceFrameListener listener) → void
Registers a low-overhead observer for every valid frame, including frames that are outside the bounded in-memory retention window. The listener is intended for append-only archives and must not throw or do expensive synchronous work; failures are isolated from frame capture.
capture(Future<void> action(), {Iterable<CockpitPerformanceEvent> events = const <CockpitPerformanceEvent>[], String? timelineSource, String? stepId, int? newGenGcCount, int? oldGenGcCount, CockpitPerformanceMemoryReport? memory, CockpitDevToolsProfile? devTools, Duration? timeout}) Future<CockpitPerformanceReport>
Captures an action and always detaches the timings callback.
dispose() → void
Detaches the timing callback. A disposed collector can be reused.
endWindow() → void
Freezes the measured interval at the end of the user action. Subsequent teardown and report-export work cannot affect frame timing or elapsed duration. stop still owns report construction and cleanup.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
record(FrameTiming timing) → void
Records a single engine timing. This is public for deterministic host or test adapters that already receive FrameTiming from Flutter.
removeFrameListener(CockpitPerformanceFrameListener listener) → void
Removes a previously registered frame observer.
start({CockpitPerformanceMode? mode}) → void
Starts one capture. A collector owns one capture at a time so that reports cannot accidentally combine unrelated actions.
stop({Iterable<CockpitPerformanceEvent> events = const <CockpitPerformanceEvent>[], String? timelineSource, String? stepId, int? newGenGcCount, int? oldGenGcCount, CockpitPerformanceMemoryReport? memory, CockpitDevToolsProfile? devTools, Iterable<CockpitPerformancePluginStats> plugins = const <CockpitPerformancePluginStats>[], int droppedEvents = 0, int invalidEvents = 0}) CockpitPerformanceReport
Stops the capture and creates a self-consistent report.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited