/// <summary> /// Gets a singleton instance /// </summary> /// <returns>singleton instance</returns> private static BrokerPerformanceCounter GetInstance() { lock (lockThis) { if (instance == null) { try { instance = new BrokerPerformanceCounter(); } catch (Exception e) { BrokerTracing.TraceEvent(TraceEventType.Warning, 0, "Exception throwed while initializing broker performance counter: {0}", e); throw; } } return(instance); } }
/// <summary> /// Update the performance counter /// </summary> public void UpdatePerformanceCounter() { BrokerPerformanceCounter.IncrementPerfCounterBy(this.key, Interlocked.Read(ref this.total) - Interlocked.Read(ref this.preTotal)); this.preTotal = Interlocked.Read(ref this.total); }