本文整理汇总了C#中ProcessHandle.GetCycleTime方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessHandle.GetCycleTime方法的具体用法?C# ProcessHandle.GetCycleTime怎么用?C# ProcessHandle.GetCycleTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessHandle
的用法示例。
在下文中一共展示了ProcessHandle.GetCycleTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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";
}
}