Пример #1
0
 public static IPerfCounterCollectorUC PerfCounterCollector(PerfCounterTypeUC perfCounterType, TimeSpan period, string processName = null, int?pid = null)
 {
     if (perfCounterType == PerfCounterTypeUC.ProcessorTime)
     {
         return(new PerfCounterCollectorUC(perfCounterType, period, processName, pid));
     }
     return(null);
 }
Пример #2
0
 public static IPerfCounterUC PerfCounter(PerfCounterTypeUC perfCounterType, string processName = null, int?pid = null)
 {
     if (perfCounterType == PerfCounterTypeUC.ProcessorTime)
     {
         return(new ProcessorTimePerfCounterUC(processName, pid));
     }
     return(null);
 }
Пример #3
0
        public static IPerfCounterUC CreatePerfCounter(this PerfCounterTypeUC perfCounterType, string processName = null, int?pid = null)
        {
            IPerfCounterFactoryUC factory;

            using (Lock.Enter())
            {
                if (!Factories.TryGetValue(perfCounterType, out factory) || factory == null)
                {
                    throw new ArgumentException($"{nameof(PerfCounterTypeUC)}.{perfCounterType} not registered!");
                }
            }

            return(factory.NewPerfCounterUC(processName, pid));
        }
 public PerfCounterCollectorUC(PerfCounterTypeUC perfCounterType, TimeSpan period, string processName = null, int?pid = null)
 {
     Next        = Period = period;
     PerfCounter = DiagnosticsUC.PerfCounter(perfCounterType, processName, pid);
 }
 public PerfCounterCollectorUC(PerfCounterTypeUC perfCounterType, TimeSpan period, string processName = null, int?pid = null)
 {
     Next        = Period = period;
     PerfCounter = perfCounterType.CreatePerfCounter(processName, pid);
 }