コード例 #1
0
            private BasicPerformanceCounter CreatePerformanceCounter(PerformanceCounterType type)
            {
                BasicPerformanceCounter counter = null;

                switch (type)
                {
                case PerformanceCounterType.CPU_Time:
                case PerformanceCounterType.RAM_Used:
                case PerformanceCounterType.DISK_Read:
                case PerformanceCounterType.DISK_Write:
                case PerformanceCounterType.Custom:
                    counter = new BasicPerformanceCounter(type, _enabled);
                    break;

                case PerformanceCounterType.NET_Received:
                case PerformanceCounterType.NET_Sent:
                    counter = new NetworkPerformanceCounter(type, _enabled);
                    break;
                }

                Debug.Assert(counter != null);

                _counters.Add(counter);

                return(counter);
            }
コード例 #2
0
            private BasicPerformanceCounter CreatePerformanceCounter(PerformanceCounterType type)
            {
                BasicPerformanceCounter counter = null;

                switch (type)
                {
                    case PerformanceCounterType.CPU_Time:
                    case PerformanceCounterType.RAM_Used:
                    case PerformanceCounterType.DISK_Read:
                    case PerformanceCounterType.DISK_Write:
                    case PerformanceCounterType.Custom:
                        counter = new BasicPerformanceCounter(type, _enabled);
                        break;
                    case PerformanceCounterType.NET_Received:
                    case PerformanceCounterType.NET_Sent:
                        counter = new NetworkPerformanceCounter(type, _enabled);
                        break;
                }

                Debug.Assert(counter != null);

                _counters.Add(counter);

                return counter;
            }