public void CategoryAndCountersCanBeCreatedAndDeleted()
        {
            PerformanceCounterRegistrar.EnsureExist();

            Assert.IsTrue(PerformanceCounterCategory.Exists(PerformanceCounterRegistrar.CategoryName));

            foreach (CounterCreationData counterDefinition in PerformanceCounterRegistrar.CounterDefinitions)
            {
                Assert.IsTrue(PerformanceCounterCategory.CounterExists(counterDefinition.CounterName,
                                                                       PerformanceCounterRegistrar.CategoryName));
            }

            PerformanceCounterRegistrar.Remove();

            Assert.IsFalse(PerformanceCounterCategory.Exists(PerformanceCounterRegistrar.CategoryName));
        }
        public void PerformanceCounterReporterFactoryCreatesInstances()
        {
            try
            {
                PerformanceCounterRegistrar.EnsureExist();

                PerformanceCounterReporter reporter =
                    PerformanceCounterReporterFactory.CreateReporter(PerformanceCounterReporterType.CreateFeature);
                Assert.IsNotNull(reporter);

                reporter =
                    PerformanceCounterReporterFactory.CreateReporter(PerformanceCounterReporterType.CheckFeatureState);
                Assert.IsNotNull(reporter);

                reporter =
                    PerformanceCounterReporterFactory.CreateReporter(PerformanceCounterReporterType.UpdateFeatureState);
                Assert.IsNotNull(reporter);
            }
            finally
            {
                PerformanceCounterRegistrar.Remove();
            }
        }
Example #3
0
 /// <summary>
 /// Removes the performance counters that have been created (Leave No Trace).
 /// </summary>
 private void CleanUpPerfCounters()
 {
     PerformanceCounterRegistrar.Remove();
 }
 public void Dispose()
 {
     PerformanceCounterRegistrar.Remove();
 }