Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public static int Start(MonitorParams counter)
        {
            Monitor monitor  = new Monitor(counter, CreateFileName(counter), Interval);
            int     threadId = monitor.Start();

            _threads.Add(threadId, monitor);

            return(threadId);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 public static void Add(MonitorParams counter)
 {
     _counters.Add(counter);
 }