private void UpdateCounterConditional(PerformanceCounter c, CounterInvokeDirection expectedDirection) { if (c != null && (expectedDirection & _direction) == expectedDirection) { lock (c) { //reset name string ins = c.InstanceName; c.Increment(); //also update overall insance! c.InstanceName = OverallInstance; c.Increment(); c.InstanceName = ins; } } }
public RatePerformanceCounterAttribute(string categoryName, string counterName, CounterInvokeDirection direction) : base(categoryName, counterName, PerformanceCounterType.RateOfCountsPerSecond32) { _direction = direction; }