Measures how long blocks of code take to run.
This class can be used as a drop-in replacement for Timeline as it provides methods compatible with Timeline signature-wise, and it has minimal overhead.
Provides debugReset and debugCollect methods that make it convenient to use in frame-oriented environment where collected metrics can be attributed to a frame, then aggregated into frame statistics, e.g. frame averages.
Forwards measurements to Timeline so they appear in Flutter DevTools.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- debugCollectionEnabled ↔ bool
-
Whether block timings are collected and can be retrieved using the
debugCollect method.
getter/setter pair
- now → int
-
The current time stamp from the clock used by the timeline in
microseconds.
no setter
Static Methods
-
debugCollect(
) → AggregatedTimings - Returns timings collected since debugCollectionEnabled was set to true, since the previous debugCollect, or since the previous debugReset, whichever was last.
-
debugReset(
) → void - Forgets all previously collected timing data.
-
finishSync(
) → void - Finish the last synchronous operation that was started.
-
instantSync(
String name, {Map< String, Object?> ? arguments}) → void - Emit an instant event.
-
startSync(
String name, {Map< String, Object?> ? arguments, Flow? flow}) → void -
Start a synchronous operation labeled
name
. -
timeSync<
T> (String name, TimelineSyncFunction< T> function, {Map<String, Object?> ? arguments, Flow? flow}) → T -
A utility method to time a synchronous
function
. Internally callsfunction
bracketed by calls to startSync and finishSync.