observeDuration<T> method

Future<T> observeDuration<T>(
  1. Future<T> f
)

Observe the duration of the Future f and store it in the summary with labels.

Implementation

Future<T> observeDuration<T>(Future<T> f) async {
  final stopwatch = Stopwatch()..start();
  try {
    return await f;
  } finally {
    observe(stopwatch.elapsedMicroseconds / Duration.microsecondsPerSecond);
  }
}