public void OnInvoke(CommandEventArgs e) { foreach (IPerformanceCounter c in PerformanceCounterRegistry.Fetch(e.CommandType)) { var counter = (IPerformanceCounter)c; switch (counter.CounterType) { case PerformanceCounterType.AverageOperationTime: ((AverageOperationTimePerformanceCounter)counter).Stopwatch.Start(); break; } } }
public void OnInvokeException(CommandExceptionEventArgs e) { foreach (IPerformanceCounter c in PerformanceCounterRegistry.Fetch(e.CommandType)) { var counter = (IPerformanceCounter)c; switch (counter.CounterType) { case PerformanceCounterType.AverageOperationTime: case PerformanceCounterType.OperationSuccessRatio: case PerformanceCounterType.OperationsPerSecond: counter.Increment(); break; } } }