Example #1
0
        #pragma warning restore 1591

        //------------------------------------------------------------------------------
        //
        // Method: Dispose
        //
        //------------------------------------------------------------------------------
        /// <summary>
        /// Provides a method to free unmanaged resources used by this class.
        /// </summary>
        /// <param name="disposing">Whether the method is being called as part of an explicit Dispose routine, and hence whether managed resources should also be freed.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    // Free other state (managed objects).
                    if (loggerImplementation != null)
                    {
                        loggerImplementation.Dispose();
                        loggerImplementation = null;
                    }
                }
                // Free your own state (unmanaged objects).

                // Set large fields to null.

                disposed = true;
            }
        }
Example #2
0
 //------------------------------------------------------------------------------
 //
 // Method: PerformanceCounterMetricLogger (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the ApplicationMetrics.PerformanceCounterMetricLogger class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="metricCategoryName">The name of the performance counter category which the metric events should be logged under.</param>
 /// <param name="metricCategoryDescription">The description of the performance counter category which the metric events should be logged under.</param>
 /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param>
 /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param>
 /// <param name="counterCreationDataCollection">A test (mock) counter creation data collection object.</param>
 /// <param name="counterCreationDataFactory">A test (mock) counter creation data factory object.</param>
 /// <param name="performanceCounterCategory">A test (mock) performance counter category object.</param>
 /// <param name="performanceCounterFactory">A test (mock) performance counter factory object.</param>
 /// <param name="dateTime">A test (mock) DateTime object.</param>
 /// <param name="exceptionHandler">A test (mock) exception handler object.</param>
 public PerformanceCounterMetricLogger(string metricCategoryName, string metricCategoryDescription, IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking, ICounterCreationDataCollection counterCreationDataCollection, ICounterCreationDataFactory counterCreationDataFactory, IPerformanceCounterCategory performanceCounterCategory, IPerformanceCounterFactory performanceCounterFactory, IDateTime dateTime, IExceptionHandler exceptionHandler)
 {
     loggerImplementation = new PerformanceCounterMetricLoggerImplementation(metricCategoryName, metricCategoryDescription, bufferProcessingStrategy, intervalMetricChecking, counterCreationDataCollection, counterCreationDataFactory, performanceCounterCategory, performanceCounterFactory, dateTime, exceptionHandler);
 }
Example #3
0
 //------------------------------------------------------------------------------
 //
 // Method: PerformanceCounterMetricLogger (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the ApplicationMetrics.PerformanceCounterMetricLogger class.
 /// </summary>
 /// <param name="metricCategoryName">The name of the performance counter category which the metric events should be logged under.</param>
 /// <param name="metricCategoryDescription">The description of the performance counter category which the metric events should be logged under.</param>
 /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param>
 /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param>
 public PerformanceCounterMetricLogger(string metricCategoryName, string metricCategoryDescription, IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking)
 {
     loggerImplementation = new PerformanceCounterMetricLoggerImplementation(metricCategoryName, metricCategoryDescription, bufferProcessingStrategy, intervalMetricChecking);
 }
Example #4
0
 //------------------------------------------------------------------------------
 //
 // Method: PerformanceCounterMetricLogger (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the ApplicationMetrics.PerformanceCounterMetricLogger class.
 /// </summary>
 /// <remarks>This constructor defaults to using the LoopingWorkerThreadBufferProcessor as the buffer processing strategy, and is maintained for backwards compatibility.</remarks>
 /// <param name="metricCategoryName">The name of the performance counter category which the metric events should be logged under.</param>
 /// <param name="metricCategoryDescription">The description of the performance counter category which the metric events should be logged under.</param>
 /// <param name="dequeueOperationLoopInterval">The time to wait (in milliseconds) between iterations of the worker thread which dequeues metric events and writes them to performance counters.</param>
 /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param>
 public PerformanceCounterMetricLogger(string metricCategoryName, string metricCategoryDescription, int dequeueOperationLoopInterval, bool intervalMetricChecking)
 {
     loggerImplementation = new PerformanceCounterMetricLoggerImplementation(metricCategoryName, metricCategoryDescription, new LoopingWorkerThreadBufferProcessor(dequeueOperationLoopInterval, false), intervalMetricChecking);
 }