shouldContinue method

bool shouldContinue()

Decides whether the data collected so far is sufficient to stop, or whether the benchmark should continue collecting more data.

The signals used are sample size, noise, and duration.

If any of the timeseries doesn't satisfy the noise requirements, this method will return true (asking the benchmark to continue collecting data).

Implementation

bool shouldContinue() {
  // If there are no `Timeseries` in the `scoreData`, then we haven't
  // recorded anything yet. Don't stop.
  if (scoreData.isEmpty) {
    return true;
  }

  // We have recorded something, but do we have enough samples? If every
  // timeseries has collected enough samples, stop the benchmark.
  return !scoreData.keys
      .every((String key) => scoreData[key]!.count >= kTotalSampleCount);
}