是否可以跟踪进程中每个模块的 CPU 利用率?在下面的代码中,可以确定 myProcess.Modules 中每个模块的 CPU 和内存消耗吗?
Process[] currentProcesses = Process.GetProcesses();
Process myProcess = currentProcesses[0];
using (PerformanceCounter pcProcess = new PerformanceCounter(
"Process",
"% Processor Time",
targetProcess.ProcessName))
using (PerformanceCounter memProcess = new PerformanceCounter(
"Process",
"Working Set - Private",
targetProcess.ProcessName))
{
pcProcess.NextValue();
}