public static void Start(string categoryName, string categoryHelp) { if (!PerformanceCounters.started) { System.AppDomain.CurrentDomain.DomainUnload += new System.EventHandler(PerformanceCounters.UnloadEventHandler); System.AppDomain.CurrentDomain.ProcessExit += new System.EventHandler(PerformanceCounters.ExitEventHandler); System.AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(PerformanceCounters.ExceptionEventHandler); PerformanceCounters.EnusreCategory(categoryName, categoryHelp); foreach (Counter current in PerformanceCounters.counters) { current.Start(categoryName); } PerformanceCounters.started = true; } }
private static void ExitEventHandler(object sender, System.EventArgs e) { PerformanceCounters.Dispose(); }