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); } } } }
public void IncrementAverage(NetworkingPerfCounterName perfCounter, long startTimestamp) { if (this.CounterAvailable()) { long amount = ((GetTimestamp() - startTimestamp) * 0x3e8L) / Stopwatch.Frequency; this.Increment(perfCounter, amount); this.Increment(perfCounter + 1, 1L); } }
public void IncrementAverage(NetworkingPerfCounterName perfCounter, long startTimestamp) { if (CounterAvailable()) { long stopTimestamp = GetTimestamp(); int avgCounterIndex = (int)perfCounter; Debug.Assert(avgCounterIndex + 1 < counters.Length); long duration = ((stopTimestamp - startTimestamp) * 1000) / Stopwatch.Frequency; Increment(perfCounter, duration); // base counter is always the next one (otherwise we wouldn't even be able to initialize the counters) Increment(perfCounter + 1, 1); } }
public void Decrement(NetworkingPerfCounterName perfCounter, long amount) { this.Increment(perfCounter, -amount); }
public void Decrement(NetworkingPerfCounterName perfCounter) { this.Increment(perfCounter, -1L); }
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); } } }
public void Increment(NetworkingPerfCounterName perfCounter) { Increment(perfCounter, 1); }