measure method

double measure()

Measures the average speed at the moment and returns the speed of processing units per second.

Implementation

double measure() {
  if (_startedAt == 0) {
    _startedAt = _stopwatch.elapsedTicks;
  }

  final time = (_stopwatch.elapsedTicks - _startedAt) * _k;
  if (time != 0) {
    return _units / (time / 1e9);
  }

  return 0;
}