public static void Stop(MonitorParams counter) { List <int> list = Find(counter.Category, counter.Counter, counter.Instance, counter.MachineName); foreach (int el in list) { Stop(el); } }
public static int Start(MonitorParams counter) { Monitor monitor = new Monitor(counter, CreateFileName(counter), Interval); int threadId = monitor.Start(); _threads.Add(threadId, monitor); return(threadId); }
private static string CreateFileName(MonitorParams counter) { string fileName = String.Format("{0}\\{1}_{2}_{3}_{4}.csv" , "" // ReporterManager.DEFAULT_OUTPUT_FOLDER , (counter.MachineName.Equals(".") ? "localhost" : counter.MachineName) , (counter.Instance == "" ? counter.Category : counter.Instance) , counter.Counter, DateTime.Now.ToString("yyMMdd")); return(fileName); }
public Monitor(MonitorParams counter, string filename, int intervalInMilliseconds = TIMEOUT_MILLISECONDS) { _counter = new PerformanceCounter(); _counter.CategoryName = counter.Category; _counter.CounterName = counter.Counter; _counter.InstanceName = counter.Instance; _counter.MachineName = counter.MachineName; this._isRunning = false; _fileName = filename; _delay = intervalInMilliseconds; }
public static void Add(MonitorParams counter) { _counters.Add(counter); }