当前位置: 首页>>代码示例>>C#>>正文


C# ProcessHandle.GetIoPriority方法代码示例

本文整理汇总了C#中ProcessHandle.GetIoPriority方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessHandle.GetIoPriority方法的具体用法?C# ProcessHandle.GetIoPriority怎么用?C# ProcessHandle.GetIoPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProcessHandle的用法示例。


在下文中一共展示了ProcessHandle.GetIoPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: menuProcess_Popup

        private void menuProcess_Popup(object sender, EventArgs e)
        {
            virtualizationProcessMenuItem.Checked = false;

            // Menu item fixup...
            if (treeProcesses.SelectedTreeNodes.Count == 0)
            {
                // If nothing is selected, disable everything.
                // The Select All menu item will be enabled later if 
                // we have at least one process in the tree.
                menuProcess.DisableAll();
            }
            else if (treeProcesses.SelectedTreeNodes.Count == 1)
            {
                // All actions should work with one process selected.
                menuProcess.EnableAll();

                // Singular nouns.
                priorityMenuItem.Text = "&Priority";
                terminateMenuItem.Text = "&Terminate Process";
                suspendMenuItem.Text = "&Suspend Process";
                resumeMenuItem.Text = "&Resume Process";

                // Clear the priority menu items.
                realTimeMenuItem.Checked = false;
                highMenuItem.Checked = false;
                aboveNormalMenuItem.Checked = false;
                normalMenuItem.Checked = false;
                belowNormalMenuItem.Checked = false;
                idleMenuItem.Checked = false;

                // Clear the I/O priority menu items.
                ioPriorityThreadMenuItem.Enabled = true;
                ioPriority0ThreadMenuItem.Checked = false;
                ioPriority1ThreadMenuItem.Checked = false;
                ioPriority2ThreadMenuItem.Checked = false;
                ioPriority3ThreadMenuItem.Checked = false;

                try
                {
                    using (var phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
                    {
                        try
                        {
                            switch (phandle.GetPriorityClass())
                            {
                                case ProcessPriorityClass.RealTime:
                                    realTimeMenuItem.Checked = true;
                                    break;
                                case ProcessPriorityClass.High:
                                    highMenuItem.Checked = true;
                                    break;
                                case ProcessPriorityClass.AboveNormal:
                                    aboveNormalMenuItem.Checked = true;
                                    break;
                                case ProcessPriorityClass.Normal:
                                    normalMenuItem.Checked = true;
                                    break;
                                case ProcessPriorityClass.BelowNormal:
                                    belowNormalMenuItem.Checked = true;
                                    break;
                                case ProcessPriorityClass.Idle:
                                    idleMenuItem.Checked = true;
                                    break;
                            }
                        }
                        catch
                        {
                            priorityMenuItem.Enabled = false;
                        }

                        try
                        {
                            if (OSVersion.HasIoPriority)
                            {
                                switch (phandle.GetIoPriority())
                                {
                                    case 0:
                                        ioPriority0ThreadMenuItem.Checked = true;
                                        break;
                                    case 1:
                                        ioPriority1ThreadMenuItem.Checked = true;
                                        break;
                                    case 2:
                                        ioPriority2ThreadMenuItem.Checked = true;
                                        break;
                                    case 3:
                                        ioPriority3ThreadMenuItem.Checked = true;
                                        break;
                                }
                            }
                        }
                        catch
                        {
                            ioPriorityThreadMenuItem.Enabled = false;
                        }
                    }
                }
                catch
                {
//.........这里部分代码省略.........
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:101,代码来源:HackerWindow.cs

示例2: UpdateStatistics

        public void UpdateStatistics()
        {
            if (!Program.ProcessProvider.Dictionary.ContainsKey(_pid))
                return;

            ProcessItem item = Program.ProcessProvider.Dictionary[_pid];

            labelCPUPriority.Text = item.Process.BasePriority.ToString();
            labelCPUKernelTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.KernelTime));
            labelCPUUserTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.UserTime));
            labelCPUTotalTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.KernelTime + item.Process.UserTime));

            labelMemoryPB.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivatePageCount);
            labelMemoryWS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.WorkingSetSize);
            labelMemoryPWS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakWorkingSetSize);
            labelMemoryVS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.VirtualSize);
            labelMemoryPVS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakVirtualSize);
            labelMemoryPU.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PagefileUsage);
            labelMemoryPPU.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakPagefileUsage);
            labelMemoryPF.Text = ((ulong)item.Process.VirtualMemoryCounters.PageFaultCount).ToString("N0");

            labelIOReads.Text = ((ulong)item.Process.IoCounters.ReadOperationCount).ToString("N0");
            labelIOReadBytes.Text = Utils.FormatSize(item.Process.IoCounters.ReadTransferCount);
            labelIOWrites.Text = ((ulong)item.Process.IoCounters.WriteOperationCount).ToString("N0");
            labelIOWriteBytes.Text = Utils.FormatSize(item.Process.IoCounters.WriteTransferCount);
            labelIOOther.Text = ((ulong)item.Process.IoCounters.OtherOperationCount).ToString("N0");
            labelIOOtherBytes.Text = Utils.FormatSize(item.Process.IoCounters.OtherTransferCount);

            labelOtherHandles.Text = ((ulong)item.Process.HandleCount).ToString("N0");

            if (_pid > 0)
            {
                try
                {
                    using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {
                        labelOtherGDIHandles.Text = phandle.GetGuiResources(false).ToString("N0");
                        labelOtherUSERHandles.Text = phandle.GetGuiResources(true).ToString("N0");

                        if (OSVersion.HasCycleTime)
                            labelCPUCycles.Text = phandle.GetCycleTime().ToString("N0");
                        else
                            labelCPUCycles.Text = "N/A";

                        if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
                        {
                            labelMemoryPP.Text = phandle.GetPagePriority().ToString();
                            labelIOPriority.Text = phandle.GetIoPriority().ToString();
                        }
                    }
                }
                catch
                { }
            }
            else
            {
                labelOtherGDIHandles.Text = "0";
                labelOtherUSERHandles.Text = "0";
                labelCPUCycles.Text = "0";
                labelMemoryPP.Text = "0";
                labelIOPriority.Text = "0";
            }
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:63,代码来源:ProcessStatistics.cs


注:本文中的ProcessHandle.GetIoPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。