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.
StartStopStats() {
reset();
start();
}
Properties
final avg #
get avg => (count == 0) ? 0.0 : total/count;
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;
}