Dart DocumentationstartstopstatsStartStopStats

StartStopStats class

class StartStopStats {
 Function displayFct;
 double displayLast = 0.0;
 double resetLast = 0.0;
 double min;
 double max;
 double total;
 int count;
 double _pstart;

 final _perf = window.performance;

 get avg => (count == 0) ? 0.0 : total/count;

 StartStopStats() {
   reset();
   start();
 }

 start() {
   _pstart = _perf.now();
 }

 stop() {
   var now = _perf.now();
   store(now - _pstart);
   if (displayFct != null) {
     displayFct(this, now);
   }
 }

 store(double t) {
   if (min > t) min = t;
   if (max < t) max = t;
   count++;
   total += t;
 }

 reset() {
   resetLast = _perf.now();
   min = double.MAX_FINITE;
   max = double.MIN_POSITIVE;
   total = 0.0;
   count = 0;
 }

}

Constructors

new StartStopStats() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
StartStopStats() {
 reset();
 start();
}

Properties

final avg #

get avg => (count == 0) ? 0.0 : total/count;

int count #

int count

Function displayFct #

Function displayFct

double displayLast #

double displayLast = 0.0

double max #

double max

double min #

double min

double resetLast #

double resetLast = 0.0

double total #

double total

Methods

dynamic reset() #

reset() {
 resetLast = _perf.now();
 min = double.MAX_FINITE;
 max = double.MIN_POSITIVE;
 total = 0.0;
 count = 0;
}

dynamic start() #

start() {
 _pstart = _perf.now();
}

dynamic stop() #

stop() {
 var now = _perf.now();
 store(now - _pstart);
 if (displayFct != null) {
   displayFct(this, now);
 }
}

dynamic store(double t) #

store(double t) {
 if (min > t) min = t;
 if (max < t) max = t;
 count++;
 total += t;
}