precisionProfileResult<T> function

T precisionProfileResult<T>(
  1. SyncVoidCallbackR<T> cb, {
  2. String? tag,
  3. ProfileReporterCallback? reporter,
})

Implementation

T precisionProfileResult<T>(SyncVoidCallbackR<T> cb,
    {String? tag, ProfileReporterCallback? reporter}) {
  PrecisionStopwatch p = PrecisionStopwatch.start();
  T t = cb();
  double ms = p.getMilliseconds();

  if (reporter != null) {
    reporter(ms);
  } else {
    verbose("${tag ?? "Runner"} took ${ms.toStringAsFixed(2)}ms");
  }
  return t;
}