public async Task RecordAsync(Task actionTask) { CheckValid(); var timer = timerFactory.CreateStarted(); try { await actionTask; } catch (Exception e) when(CheckRecordException(e)) { Debug.Fail("Exception should never be caught"); throw; } finally { timer.Stop(); Flush(new DeveloperLogEvent { LatencyMilliseconds = timer.ElapsedMilliseconds }); } }
/// <summary> /// Create and start a timer that can be used for recording arbitrary time intervals as /// actions via RecordToolAction. /// </summary> /// <returns>A timer that is in the started state.</returns> public ITimer CreateStartedTimer() { return(timerFactory.CreateStarted()); }