public void Capture(Action theAction) { var stopwatch = new Stopwatch(); stopwatch.Start(); theAction(); stopwatch.Stop(); TimerStatistics.Capture((ulong)stopwatch.ElapsedMilliseconds); }
public void StopCapture() { lock (_lockObject) { if (!IsRunning) { throw new InvalidOperationException("The timer is not currenting running so it cannot be stopped."); } _stopwatch.Stop(); TimerStatistics.Capture((ulong)_stopwatch.ElapsedMilliseconds); } }