public void Increment(NetworkingPerfCounterName perfCounter, long amount) { if (this.CounterAvailable()) { try { CounterPair pair = this.counters[(int)perfCounter]; pair.InstanceCounter.IncrementBy(amount); pair.GlobalCounter.IncrementBy(amount); } catch (InvalidOperationException exception) { if (Logging.On) { Logging.Exception(Logging.Web, "NetworkingPerfCounters", "Increment", exception); } } catch (Win32Exception exception2) { if (Logging.On) { Logging.Exception(Logging.Web, "NetworkingPerfCounters", "Increment", exception2); } } } }
public void Increment(NetworkingPerfCounterName perfCounter, long amount) { if (CounterAvailable()) { try { CounterPair cp = counters[(int)perfCounter]; Debug.Assert(cp != null); cp.InstanceCounter.IncrementBy(amount); cp.GlobalCounter.IncrementBy(amount); } // in case there is something wrong with the counter instance, just log and continue catch (InvalidOperationException e) { if (Logging.On) { Logging.Exception(Logging.Web, "NetworkingPerfCounters", "Increment", e); } } catch (Win32Exception e) { if (Logging.On) { Logging.Exception(Logging.Web, "NetworkingPerfCounters", "Increment", e); } } } }