本文整理汇总了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
{
//.........这里部分代码省略.........
示例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";
}
}