Esempio n. 1
0
        public static HRTimer create(TimerType type)
        {

            HRTimer timer = null;

            switch (type)
            {

                case TimerType.DEFAULT:
                    {
                        timer = new DefaultTimer();
                        break;
                    }
                case TimerType.MULTI_MEDIA:
                    {

                        timer = new MultiMediaTimer();
                        break;
                    }
                case TimerType.TIMER_QUEUE:
                    {
                        timer = new TimerQueueTimer();
                        break;
                    }

            }

            return (timer);
        }
Esempio n. 2
0
        public static HRTimer create(TimerType type)
        {
            HRTimer timer = null;

            switch (type)
            {
            case TimerType.DEFAULT:
            {
                timer = new DefaultTimer();
                break;
            }

            case TimerType.MULTI_MEDIA:
            {
                timer = new MultiMediaTimer();
                break;
            }

            case TimerType.TIMER_QUEUE:
            {
                timer = new TimerQueueTimer();
                break;
            }
            }

            return(timer);
        }
Esempio n. 3
0
        public DriveIdleMonitor()
        {
            drivesMonitored = new List<string>();

            PerformanceCounterCategory cat = new System.Diagnostics.PerformanceCounterCategory("PhysicalDisk");         
            string[] instNames = cat.GetInstanceNames();           

            if (instNames.Length - 1 > 0)
            {
                timers = new DefaultTimer[instNames.Length - 1];
                diskIdleTime = new PerformanceCounter[instNames.Length - 1];
            }

            int i = 0;

            foreach (string inst in instNames)
            {
                if (inst.Equals("_Total")) continue;

                timers[i] = new DefaultTimer();
                diskIdleTime[i] = new PerformanceCounter("PhysicalDisk",
                     "% Idle Time", inst);
                diskIdleTime[i].NextValue();

                timers[i].Interval = 3000;
                timers[i].Tick += new EventHandler(timer_Tick);
                timers[i].Tag = inst;
                timers[i].start();                

                char[] delimiterChars = {' '};
           
                string[] drives = inst.Split(delimiterChars);

                foreach(String drive in drives) {
                    
                    int val;
                    bool isInt = int.TryParse(drive, out val);

                    if (!isInt)
                    {
                        drivesMonitored.Add(drive);
                    }
                }

                i++;
            }        
            
        }