コード例 #1
0
        public override bool Add(ProcessPriority processPriority)
        {
            int foundProcessAtIndex = -1;

            ProcessPriority currentProcessPriority = processPriority;

            //Priority: if exists, remove oldest process that has lower priority when the process list is full
            if (ProcessListIsFull())
            {
                for (int i = _processList.Count - 1; i >= 0; i--)
                {
                    //List is ordered, so this will find oldest process with lowest priority
                    if (_processList[i].ProcessPriority <= currentProcessPriority)
                    {
                        foundProcessAtIndex    = i;
                        currentProcessPriority = _processList[i].ProcessPriority;
                    }
                }
                //if currentProcessPriority is not lower than processPriority of the new process
                //we didnt find the process with lower priority
                if (currentProcessPriority == processPriority)
                {
                    Console.WriteLine("Can't add process. Process list is full");
                    return(false);
                }

                _processList[foundProcessAtIndex].Kill();

                _processList.RemoveAt(foundProcessAtIndex);
            }

            return(AddNewProcess(processPriority));
        }
コード例 #2
0
ファイル: SchedulerForm.cs プロジェクト: Dehax/DehaxOS
        private void applyButton_Click(object sender, EventArgs e)
        {
            int             pid      = (int)pidUpDown.Value;
            ProcessPriority priority = (ProcessPriority)priorityComboBox.SelectedIndex;

            _dehaxOS.ChangeProcessPriority(pid, priority);
        }
コード例 #3
0
        public ProcessItem(int pid, ProcessPriority processPriority)
        {
            _pid = pid;

            _processPriority = processPriority;

            _creationTime = DateTime.Now;
        }
コード例 #4
0
 /// <summary>
 /// sets the priority
 /// </summary>
 /// <param name="priority"></param>
 public void setPriority(ProcessPriority priority)
 {
     Util.ThreadSafeRun(this.priority, delegate {
         isSettingPriority           = true;
         this.priority.SelectedIndex = (int)priority;
         isSettingPriority           = false;
     });
 }
コード例 #5
0
ファイル: MeGUISettings.cs プロジェクト: huannguyenfit/MeGUI
 public MeGUISettings()
 {
     autoscroll            = true;
     autoUpdateServerLists = new string[][] { new string[] { "Stable", "http://megui.org/auto/stable/", "http://mewiki.project357.com/auto/stable/" },
                                              new string[] { "Development", "http://megui.org/auto/", "http://mewiki.project357.com/auto/" } };
     acceptableFPSError      = 0.01M;
     autoUpdateServerSubList = 0;
     maxServersToTry         = 5;
     dialogSettings          = new DialogSettings();
     sdSettings            = new SourceDetectorSettings();
     AedSettings           = new AutoEncodeDefaultsSettings();
     autoUpdate            = true;
     useadvancedtooltips   = true;
     audioSamplesPerUpdate = 100000;
     avc2aviPath           = "avc2avi.exe";
     aviMuxGUIPath         = "avimux_gui.exe";
     besplitPath           = "besplit.exe";
     faacPath                    = "faac.exe";
     mencoderPath                = "mencoder.exe";
     mp4boxPath                  = "mp4box.exe";
     mkvmergePath                = "mkvmerge.exe";
     x264Path                    = "x264.exe";
     x264farmControllerPath      = "controller.exe";
     divxMuxerPath               = "divxmux.exe";
     dgIndexPath                 = "dgindex.exe";
     xvidEncrawPath              = "xvid_encraw.exe";
     lamePath                    = "lame.exe";
     neroAacEncPath              = "neroAacEnc.exe";
     oggEnc2Path                 = "oggenc2.exe";
     encAudXPath                 = "enc_AudX_CLI.exe";
     encAacPlusPath              = "enc_aacPlus.exe";
     ffmpegPath                  = "ffmpeg.exe";
     yadifPath                   = "yadif.dll";
     recalculateMainMovieBitrate = false;
     autoForceFilm               = true;
     autoStartQueue              = false;
     forceFilmThreshold          = new decimal(95);
     defaultLanguage1            = "";
     defaultLanguage2            = "";
     defaultPriority             = ProcessPriority.IDLE;
     acceptableAspectError       = 1;
     afterEncoding               = AfterEncoding.DoNothing;
     autoOpenScript              = true;
     enableMP3inMP4              = false;
     overwriteStats              = true;
     keep2of3passOutput          = false;
     deleteCompletedJobs         = false;
     autoSetNbThreads            = true;
     nbPasses                    = 2;
     deleteIntermediateFiles     = true;
     deleteAbortedOutput         = true;
     openProgressWindow          = true;
     freshOggEnc2                = true;
     videoExtension              = "";
     audioExtension              = "";
     safeProfileAlteration       = false;
 }
コード例 #6
0
        private void TypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Enable Process Appending
            if (!AddProcessBtn.Enabled)
            {
                AddProcessBtn.Enabled = true;
            }

            //Renable Schedule button
            if (!ScheduleBtn.Enabled)
            {
                ScheduleBtn.Enabled = true;
                ScheduleBtn.Text    = @"Schedule";
            }
            //Scheduler Type selected

            /*
             * 0-FCFS
             * 1-SJF (Preemptive)
             * 2-SJF (Non-Preemptive)
             * 3-Priority (Preemptive)
             * 4-Priority (Non-Preemptive)
             * 5-Round Robin
             */
            //Hide Priority input & label if selected schedule is not priority
            if (TypeComboBox.SelectedIndex != 3 && TypeComboBox.SelectedIndex != 4)
            {
                ProcessPriority.Value = 0;
                ProcessPriority.Hide();
                ProcessPriorityLabel.Hide();
                if (DataGridView != null && DataGridView.Columns.Count > 0)
                {
                    DataGridView.Columns["Priority"].Visible = false;
                }
            }
            else
            {
                ProcessPriority.Show();
                ProcessPriorityLabel.Show();
                if (DataGridView != null && DataGridView.Columns.Count > 0)
                {
                    DataGridView.Columns["Priority"].Visible = true;
                }
            }
            //Hide RR time quanta input & label if selected schedule is not Round Robin
            if (TypeComboBox.SelectedIndex != 5)
            {
                RoundRobinTimeQuanta.Hide();
                RoundRobinTimeQuantaLabel.Hide();
            }
            else
            {
                RoundRobinTimeQuanta.Show();
                RoundRobinTimeQuantaLabel.Show();
            }
        }
コード例 #7
0
        public override bool Add(ProcessPriority processPriority)
        {
            //FIFO: remove first (oldest) element if process list is full
            if (ProcessListIsFull())
            {
                _processList.RemoveAt(0);
            }

            return(AddNewProcess(processPriority));
        }
コード例 #8
0
ファイル: IOPriority.cs プロジェクト: radtek/mcebuddyviewer
        /// <summary>
        /// Change the scheduling priority for the I/O operations for a specific process
        /// </summary>
        /// <param name="process">Handle to the process</param>
        /// <param name="priority">I/O Priority</param>
        public static void SetPriority(IntPtr process, ProcessPriority priority)
        {
            if (priority == ProcessPriority.PROCESS_MODE_BACKGROUND_BEGIN || priority == ProcessPriority.PROCESS_MODE_BACKGROUND_END)
            {
                throw new ArgumentException("Process mode background can only set for current process");
            }

            try { SetPriorityClass(process, priority); }
            catch { }
        }
コード例 #9
0
ファイル: TaskManager.cs プロジェクト: eorShaman/TaskManager
        public virtual bool Add(ProcessPriority processPriority)
        {
            if (ProcessListIsFull())
            {
                Console.WriteLine("Can't add process. Process list is full");

                return(false);
            }

            return(AddNewProcess(processPriority));
        }
コード例 #10
0
 /// <summary>
 /// catches the ChangePriority event from the progresswindow and forward it to the encoder class
 /// </summary>
 /// <param name="priority"></param>
 private void pw_PriorityChanged(ProcessPriority priority)
 {
     try
     {
         currentProcessor.changePriority(priority);
     }
     catch (JobRunException e)
     {
         mainForm.addToLog("Error when attempting to change priority: " + e.Message);
     }
 }
コード例 #11
0
 /// <summary>
 /// catches the ChangePriority event from the progresswindow and forward it to the encoder class
 /// </summary>
 /// <param name="priority"></param>
 private void pw_PriorityChanged(ProcessPriority priority)
 {
     try
     {
         currentProcessor.changePriority(priority);
     }
     catch (JobRunException e)
     {
         log.LogValue("Error attempting to change priority", e, ImageType.Error);
     }
 }
コード例 #12
0
ファイル: Process.cs プロジェクト: Dehax/DehaxOS
        /// <summary>
        /// Создаёт процесс с заданным ID и временными характеристиками.
        /// </summary>
        /// <param name="pid">ID процесса.</param>
        /// <param name="cpuBurstTime">Время работы CPU, необходимое процессу.</param>
        /// <param name="ioBurstTime">Время работы I/O, необходимое процессу.</param>
        public Process(int pid, int cpuBurstTime, int ioBurstTime)
        {
            _random = new Random((int)(DateTime.UtcNow.Ticks % int.MaxValue));

            CPUburstTime = cpuBurstTime;
            IOburstTime  = ioBurstTime;

            Priority = ProcessPriority.Normal;

            PID   = pid;
            State = ProcessState.Created;
        }
コード例 #13
0
ファイル: ProgressWindow.cs プロジェクト: huannguyenfit/MeGUI
 private bool WarnPriority(ProcessPriority priority)
 {
     if (priority == ProcessPriority.HIGH)
     {
         // when user selected 'HIGH' priority
         DialogResult res = MessageBox.Show("On Windows System, running processes at high priority causes them to compete against the window manager and compositor processes. Are you sure you want to proceed?", "MeGUI", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         return(res == DialogResult.Yes);
     }
     else
     {
         return(true);
     }
 }
コード例 #14
0
        /// <summary>
        /// Посылает планировщику запрос на создание нового процесса.
        /// </summary>
        /// <param name="pid">ID процесса.</param>
        /// <param name="cpuBurstTime">Время CPU, необходимое процессу на выполнение.</param>
        /// <param name="ioBurstTime">Время I/O, необходимое процессу на выполнение.</param>
        /// <param name="priority">Приоритет процесса.</param>
        /// <param name="parent">Родительский процесс.</param>
        /// <returns>true, если процесс успешно добавлен, и false, иначе.</returns>
        public bool AddProcess(int pid, int cpuBurstTime, int ioBurstTime, ProcessPriority priority = ProcessPriority.Normal, Process parent = null)
        {
            if (ProcessExists(pid))
            {
                return(false);
            }

            Process process = new Process(pid, cpuBurstTime, ioBurstTime, priority, parent);

            _processesPendingCreation.Enqueue(process);

            return(true);
        }
コード例 #15
0
        /// <summary>
        /// Изменяет приоритет процесса в системе.
        /// </summary>
        /// <param name="pid">ID процесса, приоритет которого нужно изменить.</param>
        /// <param name="priority">Значение нового приоритета.</param>
        /// <returns>true, если приоритет процесса успешно изменён, и false, иначе.</returns>
        public bool ChangeProcessPriority(int pid, ProcessPriority priority)
        {
            Process process;

            if ((process = FindProcess(pid)) == null)
            {
                return(false);
            }

            process.Priority = priority;

            return(true);
        }
コード例 #16
0
        public void changePriority(ProcessPriority priority)
        {
            if (isRunning())
            {
                try
                {
                    switch (priority)
                    {
                    case ProcessPriority.IDLE:
                        proc.PriorityClass = ProcessPriorityClass.Idle;
                        break;

                    case ProcessPriority.BELOW_NORMAL:
                        proc.PriorityClass = ProcessPriorityClass.BelowNormal;
                        break;

                    case ProcessPriority.NORMAL:
                        proc.PriorityClass = ProcessPriorityClass.Normal;
                        break;

                    case ProcessPriority.ABOVE_NORMAL:
                        proc.PriorityClass = ProcessPriorityClass.AboveNormal;
                        break;

                    case ProcessPriority.HIGH:
                        proc.PriorityClass = ProcessPriorityClass.RealTime;
                        break;
                    }
                    VistaStuff.SetProcessPriority(proc.Handle, proc.PriorityClass);
                    MainForm.Instance.Settings.ProcessingPriority = priority;
                    return;
                }
                catch (Exception e) // process could not be running anymore
                {
                    throw new JobRunException(e);
                }
            }
            else
            {
                if (proc == null)
                {
                    throw new JobRunException("Process has not been started yet");
                }
                else
                {
                    Debug.Assert(proc.HasExited);
                    throw new JobRunException("Process has exited");
                }
            }
        }
コード例 #17
0
        public ProcessItem CreateNewProcess(ProcessPriority processPriority)
        {
            ProcessItem processItem;

            int pid = GetNextPIDNumber();

            processItem = new ProcessItem(pid, processPriority);

            Console.WriteLine(String.Format("Created process PID:{0,3} with priority:{1,-6} created:{2} ms:{3}",
                                            processItem.PID,
                                            processItem.ProcessPriority.ToString(),
                                            processItem.CreationTime,
                                            processItem.CreationTime.ToString("ffff")));

            return(processItem);
        }
コード例 #18
0
 public MeGUISettings()
 {
     dialogSettings              = new DialogSettings();
     sdSettings                  = new SourceDetectorSettings();
     AedSettings                 = new AutoEncodeDefaultsSettings();
     autoUpdate                  = true;
     useadvancedtooltips         = true;
     avc2aviPath                 = "avc2avi.exe";
     aviMuxGUIPath               = "avimux_gui.exe";
     faacPath                    = "faac.exe";
     mencoderPath                = "mencoder.exe";
     mp4boxPath                  = "mp4box.exe";
     mkvmergePath                = "mkvmerge.exe";
     x264Path                    = "x264.exe";
     divxMuxerPath               = "divxmux.exe";
     dgIndexPath                 = "dgindex.exe";
     xvidEncrawPath              = "xvid_encraw.exe";
     lamePath                    = "lame.exe";
     neroAacEncPath              = "neroAacEnc.exe";
     oggEnc2Path                 = "oggenc2.exe";
     encAudXPath                 = "enc_AudX_CLI.exe";
     encAacPlusPath              = "enc_aacPlus.exe";
     ffmpegPath                  = "ffmpeg.exe";
     recalculateMainMovieBitrate = false;
     autoForceFilm               = true;
     autoStartQueue              = false;
     forceFilmThreshold          = new decimal(95);
     defaultLanguage1            = "";
     defaultLanguage2            = "";
     defaultPriority             = ProcessPriority.IDLE;
     acceptableAspectError       = 5;
     shutdown                    = false;
     autoOpenScript              = true;
     enableMP3inMP4              = false;
     overwriteStats              = true;
     keep2of3passOutput          = false;
     deleteCompletedJobs         = false;
     autoSetNbThreads            = true;
     nbPasses                    = 2;
     deleteIntermediateFiles     = true;
     deleteAbortedOutput         = true;
     openProgressWindow          = true;
     freshOggEnc2                = true;
     videoExtension              = "";
     audioExtension              = "";
     safeProfileAlteration       = false;
 }
コード例 #19
0
        public void changePriority(ProcessPriority priority)
        {
            if (this._processThread != null && _processThread.IsAlive)
            {
                try
                {
                    switch (priority)
                    {
                    case ProcessPriority.IDLE:
                        _processThread.Priority = ThreadPriority.Lowest;
                        break;

                    case ProcessPriority.BELOW_NORMAL:
                        _processThread.Priority = ThreadPriority.BelowNormal;
                        break;

                    case ProcessPriority.NORMAL:
                        _processThread.Priority = ThreadPriority.Normal;
                        break;

                    case ProcessPriority.ABOVE_NORMAL:
                        _processThread.Priority = ThreadPriority.AboveNormal;
                        break;

                    case ProcessPriority.HIGH:
                        _processThread.Priority = ThreadPriority.Highest;
                        break;
                    }
                    return;
                }
                catch (Exception e) // process could not be running anymore
                {
                    throw new JobRunException(e);
                }
            }
            else
            {
                if (_processThread == null)
                {
                    throw new JobRunException("Thread has not been started yet");
                }
                else
                {
                    throw new JobRunException("Thread has exited");
                }
            }
        }
コード例 #20
0
ファイル: ProcessMethod.cs プロジェクト: oblivious/Oblivious
 public static void ChangePriority(ManagementScope connectionScope, 
                                   string processName,
                                   ProcessPriority.priority priority)
 {
     SelectQuery msQuery = new SelectQuery("SELECT * FROM Win32_Process Where Name = '" + processName + "'");
     ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(connectionScope, msQuery);
     foreach (ManagementObject item in searchProcedure.Get())
     {
         try{
             ManagementBaseObject methodParams = item.GetMethodParameters("SetPriority");
             methodParams["Priority"] = priority;
             item.InvokeMethod("SetPriority", methodParams, null);
         }
         catch (SystemException e){
             Console.WriteLine("An Error Occurred: " + e.Message.ToString());
         }
     }
 }
コード例 #21
0
ファイル: SchedulerForm.cs プロジェクト: Dehax/DehaxOS
        private void generateButton_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < processesNumberUpDown.Value; i++)
            {
                int             pid          = _dehaxOS.NextPID;
                int             cpuBurstTime = _random.Next((int)minCPUburstTimeUpDown.Value, (int)maxCPUburstTimeUpDown.Value);
                int             ioBurstTime  = _random.Next((int)minIOburstTimeUpDown.Value, (int)maxIOburstTimeUpDown.Value);
                ProcessPriority priority     = (ProcessPriority)_random.Next(maxPriorityComboBox.SelectedIndex, minPriorityComboBox.SelectedIndex);

                _dehaxOS.AddProcess(pid, cpuBurstTime, ioBurstTime, priority);

                logTextBox.AppendText("PID = " + pid + ", CPU = " + cpuBurstTime + ", I/O = " + ioBurstTime + ", Priority = " + priority + "\n");
            }

            logTextBox.AppendText("============================================\n");

            MessageBox.Show(this, "Процессы успешно сгенерированы!", "Процессы созданы!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #22
0
ファイル: TaskManager.cs プロジェクト: eorShaman/TaskManager
        protected bool AddNewProcess(ProcessPriority processPriority)
        {
            ProcessItem processItem;

            int pid = getNextPIDNumber();

            processItem = new ProcessItem(pid, processPriority);

            _processList.Add(processItem); //Add to the end of list

            Console.WriteLine(String.Format("Added process PID:{0,3} with priority:{1,-6} created:{2} ms:{3}",
                                            processItem.PID,
                                            processItem.ProcessPriority.ToString(),
                                            processItem.CreationTime,
                                            processItem.CreationTime.ToString("ffff")));

            return(true);
        }
コード例 #23
0
ファイル: ISProcess.cs プロジェクト: preguntoncojonero/test
        public static bool StartAsyncProcess(DelegateAsyncMethod methodName, ProcessPriority threadPriority,
            object objState)
        {
            var objParameterizedThreadStart = new ParameterizedThreadStart(methodName);

            var objThread = new Thread(objParameterizedThreadStart, 0);
            objThread.Priority = (ThreadPriority) threadPriority;

            try
            {
                objThread.Start(objState);
                return true;
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                return false;
            }
        }
コード例 #24
0
        public static bool StartAsyncProcess(DelegateAsyncMethod methodName, ProcessPriority threadPriority,
                                             object objState)
        {
            var objParameterizedThreadStart = new ParameterizedThreadStart(methodName);

            var objThread = new Thread(objParameterizedThreadStart, 0);

            objThread.Priority = (ThreadPriority)threadPriority;

            try
            {
                objThread.Start(objState);
                return(true);
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                return(false);
            }
        }
コード例 #25
0
 public override bool changePriority(ProcessPriority priority, out string error)
 {
     error = null;
     if (this._encoderThread != null && _encoderThread.IsAlive)
     {
         try
         {
             if (priority == ProcessPriority.IDLE)
             {
                 _encoderThread.Priority = ThreadPriority.Lowest;
             }
             else if (priority == ProcessPriority.NORMAL)
             {
                 _encoderThread.Priority = ThreadPriority.Normal;
             }
             else if (priority == ProcessPriority.HIGH)
             {
                 _encoderThread.Priority = ThreadPriority.AboveNormal;
             }
             return(true);
         }
         catch (Exception e) // process could not be running anymore
         {
             error = "exception in change Priority: " + e.Message;
             return(false);
         }
     }
     else
     {
         if (_encoderThread == null)
         {
             error = "Thread has not been started yet";
         }
         else
         {
             error = "Thread has exited";
         }
         return(false);
     }
 }
コード例 #26
0
 public override bool changePriority(ProcessPriority priority, out string error)
 {
     error = null;
     if (proc != null && !proc.HasExited)
     {
         try
         {
             if (priority == ProcessPriority.IDLE)
             {
                 proc.PriorityClass = ProcessPriorityClass.Idle;
             }
             else if (priority == ProcessPriority.NORMAL)
             {
                 proc.PriorityClass = ProcessPriorityClass.Normal;
             }
             else if (priority == ProcessPriority.HIGH)
             {
                 proc.PriorityClass = ProcessPriorityClass.High;
             }
             return(true);
         }
         catch (Exception e) // process could not be running anymore
         {
             error = "exception in changeProcessPriority: " + e.Message;
             return(false);
         }
     }
     else
     {
         if (proc == null)
         {
             error = "Process has not been started yet";
         }
         else
         {
             error = "Process has exited";
         }
         return(false);
     }
 }
コード例 #27
0
ファイル: TaskManager.cs プロジェクト: eorShaman/TaskManager
        public int KillGroup(ProcessPriority processPriority)
        {
            int removedProcessCount = 0;

            for (int i = _processList.Count - 1; i >= 0; i--)
            {
                if (processPriority == _processList[i].ProcessPriority)
                {
                    _processList[i].Kill();

                    _processList.RemoveAt(i);

                    removedProcessCount++;
                }
            }

            if (removedProcessCount == 0)
            {
                Console.WriteLine("Processes with priority:{0} don't exists", processPriority.ToString());
            }
            return(removedProcessCount);
        }
コード例 #28
0
 public void changePriority(ProcessPriority priority)
 {
     if (isRunning())
     {
         try
         {
             if (priority == ProcessPriority.IDLE)
             {
                 proc.PriorityClass = ProcessPriorityClass.Idle;
             }
             else if (priority == ProcessPriority.NORMAL)
             {
                 proc.PriorityClass = ProcessPriorityClass.Normal;
             }
             else if (priority == ProcessPriority.HIGH)
             {
                 proc.PriorityClass = ProcessPriorityClass.High;
             }
             return;
         }
         catch (Exception e) // process could not be running anymore
         {
             throw new JobRunException(e);
         }
     }
     else
     {
         if (proc == null)
         {
             throw new JobRunException("Process has not been started yet");
         }
         else
         {
             Debug.Assert(proc.HasExited);
             throw new JobRunException("Process has exited");
         }
     }
 }
コード例 #29
0
 /// <summary>
 /// changes the priority of the encoding process/thread
 /// </summary>
 /// <param name="priority">the priority to change to</param>
 /// <param name="error">output for any errors that might ocurr during this method</param>
 /// <returns>true if the priority has been changed, false if not</returns>
 public void changePriority(ProcessPriority priority)
 {
     if (processorThread != null && processorThread.IsAlive)
     {
         try
         {
             if (priority == ProcessPriority.IDLE)
             {
                 processorThread.Priority = ThreadPriority.Lowest;
             }
             else if (priority == ProcessPriority.NORMAL)
             {
                 processorThread.Priority = ThreadPriority.Normal;
             }
             else if (priority == ProcessPriority.HIGH)
             {
                 processorThread.Priority = ThreadPriority.Highest;
             }
             return;
         }
         catch (Exception e) // process could not be running anymore
         {
             throw new JobRunException(e);
         }
     }
     else
     {
         if (processorThread == null)
         {
             throw new JobRunException("Process has not been started yet");
         }
         else
         {
             throw new JobRunException("Process has exited");
         }
     }
 }
コード例 #30
0
ファイル: IOPriority.cs プロジェクト: hoeness2/mcebuddy2
 /// <summary>
 /// Change the scheduling priority for the I/O operations for the current process
 /// </summary>
 /// <param name="priority">I/O Priority</param>
 public static void SetPriority(ProcessPriority priority)
 {
     try { SetPriorityClass(GetCurrentProcess(), priority); }
     catch { }
 }
コード例 #31
0
ファイル: DehaxScheduler.cs プロジェクト: Dehax/DehaxOS
        /// <summary>
        /// Изменяет приоритет процесса в системе.
        /// </summary>
        /// <param name="pid">ID процесса, приоритет которого нужно изменить.</param>
        /// <param name="priority">Значение нового приоритета.</param>
        /// <returns>true, если приоритет процесса успешно изменён, и false, иначе.</returns>
        public bool ChangeProcessPriority(int pid, ProcessPriority priority)
        {
            Process process;

            if ((process = FindProcess(pid)) == null)
            {
                return false;
            }

            process.Priority = priority;

            return true;
        }
コード例 #32
0
ファイル: DehaxScheduler.cs プロジェクト: Dehax/DehaxOS
        /// <summary>
        /// Посылает планировщику запрос на создание нового процесса.
        /// </summary>
        /// <param name="pid">ID процесса.</param>
        /// <param name="cpuBurstTime">Время CPU, необходимое процессу на выполнение.</param>
        /// <param name="ioBurstTime">Время I/O, необходимое процессу на выполнение.</param>
        /// <param name="priority">Приоритет процесса.</param>
        /// <param name="parent">Родительский процесс.</param>
        /// <returns>true, если процесс успешно добавлен, и false, иначе.</returns>
        public bool AddProcess(int pid, int cpuBurstTime, int ioBurstTime, ProcessPriority priority = ProcessPriority.Normal, Process parent = null)
        {
            if (ProcessExists(pid))
            {
                return false;
            }

            Process process = new Process(pid, cpuBurstTime, ioBurstTime, priority, parent);

            _processesPendingCreation.Enqueue(process);

            return true;
        }
コード例 #33
0
ファイル: CleanupJob.cs プロジェクト: huannguyenfit/MeGUI
 void IJobProcessor.changePriority(ProcessPriority priority)
 {
     throw new JobRunException("Not supported");
 }
コード例 #34
0
ファイル: CleanupJob.cs プロジェクト: RoDaniel/featurehouse
void IJobProcessor.changePriority(ProcessPriority priority)
{
    throw new JobRunException("Not supported");
}
コード例 #35
0
ファイル: JobWorker.cs プロジェクト: RoDaniel/featurehouse
 /// <summary>
 /// catches the ChangePriority event from the progresswindow and forward it to the encoder class
 /// </summary>
 /// <param name="priority"></param>
 private void pw_PriorityChanged(ProcessPriority priority)
 {
     try
     {
         currentProcessor.changePriority(priority);
     }
     catch (JobRunException e)
     {
         mainForm.addToLog("Error when attempting to change priority: " + e.Message);
     }
 }
コード例 #36
0
ファイル: ProcessLocal.cs プロジェクト: oblivious/Oblivious
 public void SetPriority(string processName, ProcessPriority.priority priority)
 {
     ProcessMethod.ChangePriority(connectionScope, processName, priority);
 }
コード例 #37
0
ファイル: DehaxOS.cs プロジェクト: Dehax/DehaxOS
 /// <summary>
 /// Посылает планировщику запрос на создание нового процесса.
 /// </summary>
 /// <param name="pid">ID процесса.</param>
 /// <param name="cpuBurstTime">Время CPU, необходимое процессу на выполнение.</param>
 /// <param name="ioBurstTime">Время I/O, необходимое процессу на выполнение.</param>
 /// <param name="priority">Приоритет процесса.</param>
 /// <param name="parent">Родительский процесс.</param>
 /// <returns>true, если процесс успешно добавлен, и false, иначе.</returns>
 public bool AddProcess(int pid, int cpuBurstTime, int ioBurstTime, ProcessPriority priority = ProcessPriority.Normal, Process parent = null)
 {
     return Scheduler.AddProcess(pid, cpuBurstTime, ioBurstTime, priority, parent);
 }
コード例 #38
0
ファイル: IOPriority.cs プロジェクト: hoeness2/mcebuddy2
 private static extern bool SetPriorityClass(IntPtr handle, ProcessPriority priorityClass);
コード例 #39
0
        public MeGUISettings()
        {
            strMeGUIPath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
            autoscroll = true;
            autoUpdateServerLists = new string[][] { new string[] { "Stable", "http://megui.org/auto/stable/", "http://megui.xvidvideo.ru/auto/stable/" },
                new string[] { "Development", "http://megui.org/auto/", "http://megui.xvidvideo.ru/auto/" } };
            acceptableFPSError = 0.01M;
            autoUpdateServerSubList = 0;
            maxServersToTry = 5;
            dialogSettings = new DialogSettings();
            sdSettings = new SourceDetectorSettings();
            AedSettings = new AutoEncodeDefaultsSettings();
            autoUpdate = true;
            useadvancedtooltips = true;
            audioSamplesPerUpdate = 100000;
            aviMuxGUIPath = getDownloadPath(@"tools\avimux_gui\avimux_gui.exe");
            besplitPath = "besplit.exe";
            faacPath = getDownloadPath(@"tools\faac\faac.exe");
            mencoderPath = getDownloadPath(@"tools\mencoder\mencoder.exe");
            mp4boxPath = getDownloadPath(@"tools\mp4box\mp4box.exe");
            mkvmergePath = getDownloadPath(@"tools\mkvmerge\mkvmerge.exe");

            x264Path = getDownloadPath(@"tools\x264\x264_64.exe");

            x264Path = getDownloadPath(@"tools\x264\x264.exe");

            dgIndexPath = getDownloadPath(@"tools\dgindex\dgindex.exe");
            ffmsIndexPath = getDownloadPath(@"tools\ffms\ffmsindex.exe");
            xvidEncrawPath = getDownloadPath(@"tools\xvid_encraw\xvid_encraw.exe");
            lamePath = getDownloadPath(@"tools\lame\lame.exe");
            neroAacEncPath = "neroAacEnc.exe";
            oggEnc2Path = getDownloadPath(@"tools\oggenc2\oggenc2.exe");
            encAudXPath = getDownloadPath(@"tools\encaudxcli\enc_AudX_CLI.exe");
            encAacPlusPath = getDownloadPath(@"tools\enc_aacplus\enc_aacPlus.exe");
            ffmpegPath = getDownloadPath(@"tools\ffmpeg\ffmpeg.exe");
            aftenPath = getDownloadPath(@"tools\aften\aften.exe");
            yadifPath = getDownloadPath(@"tools\yadif\yadif.dll");
            recalculateMainMovieBitrate = false;
            autoForceFilm = true;
            autoStartQueue = false;
            forceFilmThreshold = new decimal(95);
            defaultLanguage1 = "";
            defaultLanguage2 = "";
            defaultPriority = ProcessPriority.IDLE;
            acceptableAspectError = 1;
            afterEncoding = AfterEncoding.DoNothing;
            autoOpenScript = true;
            enableMP3inMP4 = false;
            overwriteStats = true;
            keep2of3passOutput = false;
            deleteCompletedJobs = false;
            nbPasses = 2;
            deleteIntermediateFiles = true;
            deleteAbortedOutput = true;
            openProgressWindow = true;
            freshOggEnc2 = true;
            videoExtension = "";
            audioExtension = "";
            safeProfileAlteration = false;
            alwaysOnTop = false;
            usehttpproxy = false;
            httpproxyaddress = "";
            httpproxyport = "";
            httpproxyuid = "";
            httpproxypwd = "";
            defaultOutputDir = "";
            tempDirMP4 = "";
            addTimePosition = false;
            dgavcIndexPath = getDownloadPath(@"tools\dgavcindex\dgavcindex.exe");
            dgnvIndexPath = getDownloadPath(@"tools\dgindexnv\dgindexnv.exe");
            eac3toPath = getDownloadPath(@"tools\eac3to\eac3to.exe");
            tsmuxerPath = getDownloadPath(@"tools\tsmuxer\tsmuxer.exe");
            alwaysbackupfiles = true;
            forcerawavcextension = false;
            meguiupdatecache = System.IO.Path.Combine(strMeGUIPath, "update_cache");
            avisynthpluginspath = System.IO.Path.Combine(strMeGUIPath, @"tools\avisynth_plugin");
            strMainFileFormat = "";
            strMainAudioFormat = "";
            strLastSourcePath = "";
            strLastDestinationPath = "";
            bUseCUVIDserver = false;
            minComplexity = 72;
            maxComplexity = 78;
        }
コード例 #40
0
ファイル: Process.cs プロジェクト: Dehax/DehaxOS
 /// <summary>
 /// Создаёт процесс с заданным ID, временными характеристиками и приоритетом.
 /// </summary>
 /// <param name="pid">ID процесса.</param>
 /// <param name="cpuBurstTime">Время работы CPU, необходимое процессу.</param>
 /// <param name="ioBurstTime">Время работы I/O, необходимое процессу.</param>
 /// <param name="priority">Приоритет процесса.</param>
 public Process(int pid, int cpuBurstTime, int ioBurstTime, ProcessPriority priority)
     : this(pid, cpuBurstTime, ioBurstTime)
 {
     Priority = priority;
 }
コード例 #41
0
ファイル: Process.cs プロジェクト: Dehax/DehaxOS
 /// <summary>
 /// Создаёт процесс с заданным ID процесса, временными характеристиками и родительским процессом.
 /// </summary>
 /// <param name="pid">ID процесса.</param>
 /// <param name="cpuBurstTime">Время работы CPU, необходимое процессу.</param>
 /// <param name="ioBurstTime">Время работы I/O, необходимое процессу.</param>
 /// <param name="priority">Приоритет процесса.</param>
 /// <param name="parent">Родительский процесс.</param>
 public Process(int pid, int cpuBurstTime, int ioBurstTime, ProcessPriority priority, Process parent)
     : this(pid, cpuBurstTime, ioBurstTime, priority)
 {
     Parent = parent;
 }
コード例 #42
0
ファイル: IOPriority.cs プロジェクト: radtek/mcebuddyviewer
 /// <summary>
 /// Change the scheduling priority for the I/O operations for the current process
 /// </summary>
 /// <param name="priority">I/O Priority</param>
 public static void SetPriority(ProcessPriority priority)
 {
     try { SetPriorityClass(GetCurrentProcess(), priority); }
     catch { }
 }
コード例 #43
0
ファイル: DehaxOS.cs プロジェクト: Dehax/DehaxOS
 /// <summary>
 /// Изменяет приоритет процесса в системе.
 /// </summary>
 /// <param name="pid">ID процесса, приоритет которого нужно изменить.</param>
 /// <param name="priority">Значение нового приоритета.</param>
 /// <returns>true, если приоритет процесса успешно изменён, и false, иначе.</returns>
 public bool ChangeProcessPriority(int pid, ProcessPriority priority)
 {
     return Scheduler.ChangeProcessPriority(pid, priority);
 }
コード例 #44
0
ファイル: IOPriority.cs プロジェクト: radtek/mcebuddyviewer
 private static extern bool SetPriorityClass(IntPtr handle, ProcessPriority priorityClass);
コード例 #45
0
ファイル: IOPriority.cs プロジェクト: hoeness2/mcebuddy2
        /// <summary>
        /// Change the scheduling priority for the I/O operations for a specific process
        /// </summary>
        /// <param name="process">Handle to the process</param>
        /// <param name="priority">I/O Priority</param>
        public static void SetPriority(IntPtr process, ProcessPriority priority)
        {
            if (priority == ProcessPriority.PROCESS_MODE_BACKGROUND_BEGIN || priority == ProcessPriority.PROCESS_MODE_BACKGROUND_END)
                throw new ArgumentException("Process mode background can only set for current process");

            try { SetPriorityClass(process, priority); }
            catch { }
        }