Measurement class
The timing result of one benchmark.
Times are per run of the benchmark. The representative time is the median of the per-batch samples, which resists GC pauses and scheduler noise better than the mean.
Constructors
-
Measurement({required double runtimeMicros, required double bestMicros, required double worstMicros, required double deviationMicros, required int rounds, required int samples, int size = 0, List<
double> sampleMicros = const []}) -
Creates a measurement from already-summarized values.
const
-
Measurement.fromJson(Map<
String, Object?> json) -
Restores a measurement written by toJson.
factory
-
Measurement.fromSamples(List<
double> perRunMicros, {int? rounds, int size = 0}) -
Summarizes per-run times in microseconds, one per measured batch.
factory
Properties
- bestMicros → double
-
Fastest per-run sample, in microseconds.
final
- cv → double
-
Coefficient of variation: stdDevMicros as a fraction of
meanMicros. Below 0.1 is reliable; above 0.5 is mostly noise.
no setter
- deviationMicros → double
-
Median absolute deviation of the samples, in microseconds.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- meanMicros → double
-
Mean of sampleMicros; runtimeMicros when there are no samples.
no setter
- rate → double
-
Runs per second, from the median time.
no setter
- relativeDeviation → double
-
deviationMicros as a fraction of runtimeMicros; 0.02 means the
typical sample is within 2% of the median.
no setter
- rounds → int
-
Total number of runs measured.
final
- runtimeMicros → double
-
Median time of one run, in microseconds.
final
- runtimeMillis → double
-
Median time of one run, in milliseconds.
no setter
- runtimeSeconds → double
-
Median time of one run, in seconds.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sampleMicros
→ List<
double> -
The per-run time of every sample in microseconds, sorted. Empty when
the measurement was built from summarized values only. Comparisons use
the samples to test whether a difference is significant.
final
- samples → int
-
Number of samples (measured batches).
final
- size → int
-
Units processed per run, from the benchmark's
size: usually bytes, but any unit works with a matching metric.final - speed → double
-
Units per second: size times rate.
no setter
- stdDevMicros → double
-
Sample standard deviation of sampleMicros; 0 with fewer than two.
no setter
- worstMicros → double
-
Slowest per-run sample, in microseconds.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object> - This measurement as JSON-encodable values.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited