Example #1
0
 /// <summary>
 /// Entry point for the
 /// </summary>
 private static void Main()
 {
     try
     {
         PerformanceCounterRegistrar.EnsureExist();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
        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 #4
0
 /// <summary>
 /// Ensures that the performance counters exist on the host machine.
 /// </summary>
 private void ConfigurePerfCounters()
 {
     PerformanceCounterRegistrar.EnsureExist();
 }
Example #5
0
 /// <summary>
 /// Removes the performance counters that have been created (Leave No Trace).
 /// </summary>
 private void CleanUpPerfCounters()
 {
     PerformanceCounterRegistrar.Remove();
 }
 public static IDisposable Create()
 {
     PerformanceCounterRegistrar.EnsureExist();
     return(new PerformanceCounterRegistrarDisposable());
 }
 public void Dispose()
 {
     PerformanceCounterRegistrar.Remove();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 /// <remarks></remarks>
 public FeatureStoreTests()
 {
     PerformanceCounterRegistrar.EnsureExist();
     Debug.WriteLine("PerformanceCounterRegistrar.EnsureExist");
     m_StorageContainer = m_MockRepository.StrictMock <IStorageContainer>();
 }