public void Observe(Action action) { var stopwatch = Stopwatch.StartNew(); InPerSec.Increment(); try { action(); } finally { if (System.Runtime.InteropServices.Marshal.GetExceptionCode() != 0) { ErrorsPerSec.Increment(); } PendingTimeAverage.Increment(stopwatch); OutPerSec.Increment(); } }