foreach (Process ps in Process.GetProcesses())
{
PerformanceCounter pf1 = new PerformanceCounter("Process", "Working Set - Private", ps.ProcessName);
PerformanceCounter pf2 = new PerformanceCounter("Process", "Working Set", ps.ProcessName);
//私有工作集
Console.WriteLine("{0}:{1} {2:N}KB", ps.ProcessName, "私有工作集 ", pf1.NextValue() / 1024);
}
C# 获取进程名称和所占用的内存
最新推荐文章于 2023-05-05 16:28:04 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)