子进程InstanceName
是父进程的名称,附加了#n。有了这个,这可能会有所帮助。以下获取所有 Chrome 进程的处理器时间总和:
(new PerformanceCounterCategory("Process"))
.GetInstanceNames()
.Where(a => a.StartsWith("chrome"))
.Select(a => new PerformanceCounter("Process", "% Processor Time", a).NextValue())
.Sum()