/// <summary> /// Disposes performance measurement. /// </summary> public void Dispose() { if (m_stopwatch != null) { m_stopwatch.Stop(); LoggingHelpers.LogCategorizedStatistic(LoggingContext, LoggingContext.LoggerComponentInfo, Statistics.DurationMs, (int)m_stopwatch.ElapsedMilliseconds); } if (m_aggregator != null) { LoggingHelpers.LogPerformanceCollector(m_aggregator, LoggingContext, LoggingContext.LoggerComponentInfo); m_aggregator.Dispose(); } m_endAction(LoggingContext); m_isDisposed = true; }
/// <summary> /// Disposes performance measurement. /// </summary> public void Dispose() { TEndObject endObj = m_endObjGetter(); m_stopwatch.Stop(); endObj.ElapsedMilliseconds = (int)m_stopwatch.ElapsedMilliseconds; m_endAction(m_loggingContext, endObj); if (!string.IsNullOrWhiteSpace(m_loggingContext.LoggerComponentInfo)) { LoggingHelpers.LogCategorizedStatistic(m_loggingContext, m_loggingContext.LoggerComponentInfo, Statistics.DurationMs, (int)m_stopwatch.ElapsedMilliseconds); } if (m_aggregator != null) { LoggingHelpers.LogPerformanceCollector(m_aggregator, m_loggingContext, m_loggingContext.LoggerComponentInfo); m_aggregator.Dispose(); } m_isDisposed = true; }