Skip to content

Instantly share code, notes, and snippets.

@tomaustin700
Created December 11, 2018 21:18
Show Gist options
  • Save tomaustin700/3d58b541f22ac8c4d9bca38ea42da65a to your computer and use it in GitHub Desktop.
Save tomaustin700/3d58b541f22ac8c4d9bca38ea42da65a to your computer and use it in GitHub Desktop.
public static async Task Time(Func<Task> action, EventGauge gauge)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
await action.Invoke();
stopwatch.Stop();
gauge.Record(stopwatch.Elapsed.TotalMilliseconds, DateTime.Now);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment