/// <summary>
        /// Creates CPU counter
        /// </summary>
        public static SimpleCounter CreateCPUCounter()
        {
            // Créer un compteur par CPU
            System.Diagnostics.PerformanceCounterCategory category = new System.Diagnostics.PerformanceCounterCategory("Processor");
            SimpleCounter        mainCounter = null;
            List <SimpleCounter> counters    = new List <SimpleCounter>();

            foreach (string instance in category.GetInstanceNames().OrderBy(s => s))
            {
                System.Diagnostics.PerformanceCounter pc = new System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", instance, true);

                SimpleCounter counter = new KnownMaxPerformanceCounter(new PerformanceCounter(pc), new StaticPerformanceCounter(100));

                if (instance == "_Total")
                {
                    mainCounter = counter;
                }
                else
                {
                    counters.Add(counter);
                }
            }

            return(new SubPerformanceCounter(mainCounter, counters));
        }
        /// <summary>
        /// Creates CPU percentage of max frequency counter
        /// </summary>
        public static SimpleCounter CreateCPUFrequencyCounter()
        {
            // Créer un compteur par CPU
            System.Diagnostics.PerformanceCounterCategory category = new System.Diagnostics.PerformanceCounterCategory("ProcessorPerformance");
            SimpleCounter        mainCounter = null;
            List <SimpleCounter> counters    = new List <SimpleCounter>();

            foreach (string instance in category.GetInstanceNames().OrderBy(s => s))
            {
                System.Diagnostics.PerformanceCounter pc = new System.Diagnostics.PerformanceCounter("ProcessorPerformance", "percentage", instance, true);

                SimpleCounter counter = new KnownMaxPerformanceCounter(new PerformanceCounter(pc), new StaticPerformanceCounter(100));

                counters.Add(counter);
            }

            mainCounter = new SumPerformanceCounter(counters);
            return(new SubPerformanceCounter(mainCounter, counters));
        }
        /// <summary>
        /// Creates CPU counter
        /// </summary>
        public static SimpleCounter CreateCPUCounter()
        {
            // Créer un compteur par CPU
            System.Diagnostics.PerformanceCounterCategory category = new System.Diagnostics.PerformanceCounterCategory("Processor");
            SimpleCounter mainCounter = null;
            List<SimpleCounter> counters = new List<SimpleCounter>();
            foreach (string instance in category.GetInstanceNames().OrderBy(s => s))
            {
                System.Diagnostics.PerformanceCounter pc = new System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", instance, true);

                SimpleCounter counter = new KnownMaxPerformanceCounter(new PerformanceCounter(pc), new StaticPerformanceCounter(100));

                if (instance == "_Total")
                {
                    mainCounter = counter;
                }
                else
                {
                    counters.Add(counter);
                }
            }

            return new SubPerformanceCounter(mainCounter, counters);
        }
		/// <summary>
        /// Creates CPU percentage of max frequency counter
        /// </summary>
        public static SimpleCounter CreateCPUFrequencyCounter()
        {
            // Créer un compteur par CPU
            System.Diagnostics.PerformanceCounterCategory category = new System.Diagnostics.PerformanceCounterCategory("ProcessorPerformance");
            SimpleCounter mainCounter = null;
            List<SimpleCounter> counters = new List<SimpleCounter>();
            foreach (string instance in category.GetInstanceNames().OrderBy(s => s))
            {
                System.Diagnostics.PerformanceCounter pc = new System.Diagnostics.PerformanceCounter("ProcessorPerformance", "percentage", instance, true);

                SimpleCounter counter = new KnownMaxPerformanceCounter(new PerformanceCounter(pc), new StaticPerformanceCounter(100));

                counters.Add(counter);
            }

            mainCounter = new SumPerformanceCounter(counters);
            return new SubPerformanceCounter(mainCounter, counters);
        }