public ChirperPerformanceCounters(string instanceName) { ChirpsPerSecond = new ChirperPerformanceCounterLong(null); // in case we fail to open the counters, initialize with dummies doing nothing so that the perf counter calls are ignored if (PerformanceCounterCategory.Exists(CategoryName)) { try { ChirpsPerSecond = new ChirperPerformanceCounterLong(new PerformanceCounter(CategoryName, ChirpsPerSecondName, instanceName, false)); } catch { Console.WriteLine("Failed to initialize performance counters"); } } else { Console.WriteLine("Performance counter category {0} not found. Make sure the category and the counters are registered properly.", CategoryName); } }
public ChirperPerformanceCounters(string instanceName) { ChirpsPerSecond = new ChirperPerformanceCounterLong(null); // in case we fail to open the counters, initialize with dummies doing nothing so that the perf counter calls are ignored if (PerformanceCounterCategory.Exists(CategoryName)) { try { ChirpsPerSecond = new ChirperPerformanceCounterLong(new PerformanceCounter(CategoryName, ChirpsPerSecondName, instanceName, false)); } catch { Console.WriteLine("Failed to initialize performance counters"); } } else { Console.WriteLine("Performance counter category {0} not found. Make sure the category and the counters are registered properly.", CategoryName); } }