precisionProfileAsyncResult<T> function

Future<T> precisionProfileAsyncResult<T>(
  1. AsyncVoidCallbackR<T> cb, {
  2. String? tag,
  3. ProfileReporterCallback? reporter,
})

Implementation

Future<T> precisionProfileAsyncResult<T>(AsyncVoidCallbackR<T> cb,
    {String? tag, ProfileReporterCallback? reporter}) async {
  PrecisionStopwatch p = PrecisionStopwatch.start();
  T t = await cb();
  double ms = p.getMilliseconds();

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

  return t;
}