endFrame method
Completes frame timing and returns statistics.
Implementation
@override
PerfStats endFrame(dynamic _) {
_sw.stop();
final cpuMs = _sw.elapsedMicroseconds / 1000.0;
_cpu.add(cpuMs);
final harvestedMs = _harvest();
if (harvestedMs != null) _gpu.add(harvestedMs);
return PerfStats(
cpuMsAvg: _cpu.value,
gpuMsAvg: _gpu.value == 0 ? null : _gpu.value,
);
}