public static PerformanceCounter GetPerfCounter(BrokerPerformanceCounterKey key) { switch (key) { case BrokerPerformanceCounterKey.RequestMessages: return(new PerformanceCounter(NodeCategoryName, RequestsPerSecCounterName, false)); case BrokerPerformanceCounterKey.ResponseMessages: return(new PerformanceCounter(NodeCategoryName, ResponsesPerSecCounterName, false)); case BrokerPerformanceCounterKey.Calculations: return(new PerformanceCounter(NodeCategoryName, CalculationsPerSecCounterName, false)); case BrokerPerformanceCounterKey.Faults: return(new PerformanceCounter(NodeCategoryName, FaultsPerSecCounterName, false)); case BrokerPerformanceCounterKey.DurableRequestsQueueLength: return(new PerformanceCounter(NodeCategoryName, DurableRequestsQueueLengthCounterName, false)); case BrokerPerformanceCounterKey.DurableResponsesQueueLength: return(new PerformanceCounter(NodeCategoryName, DurableResponsesQueueLengthCounterName, false)); default: throw new ArgumentException("Invalid performance counter key", "key"); } }
public static PerformanceCounter GetPerfCounter(BrokerPerformanceCounterKey key, string instanceName) { switch (key) { default: throw new ArgumentException("Invalid performance counter key", "key"); } }
/// <summary> /// Increase the perf counter /// </summary> /// <param name="key">indicate the counter key</param> /// <param name="delta">indicate the delta</param> public static void IncrementPerfCounterBy(BrokerPerformanceCounterKey key, long delta) { try { if (delta != 0) { GetInstance().counters[(int)key].IncrementBy(delta); } } catch (Exception e) { BrokerTracing.TraceEvent(TraceEventType.Warning, 0, "Exception throwed while updating perf counter: {0}", e); } }
/// <summary> /// Initializes a new instance of the ObserverItem class /// </summary> /// <param name="key">indicate the performance counter key</param> public ObserverItem(BrokerPerformanceCounterKey key) { this.key = key; }