C# 如何在Windows中查找特定进程在该时刻的cpu使用率
可以在Windows中以编程方式(以任何语言)了解正在运行/空闲进程的CPU使用情况吗?在C# 如何在Windows中查找特定进程在该时刻的cpu使用率,c#,java,c++,c,windows,C#,Java,C++,C,Windows,可以在Windows中以编程方式(以任何语言)了解正在运行/空闲进程的CPU使用情况吗?在C中,可以执行以下操作: private PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName); cpuCounter.NextValue(); // it will give you cpu usage
C
中,可以执行以下操作:
private PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
cpuCounter.NextValue(); // it will give you cpu usage
有关详细信息,请参阅。在C#
中,您可以执行以下操作:
private PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
cpuCounter.NextValue(); // it will give you cpu usage
有关详细信息,请参阅。如果不支持旧的Windows版本(早于Windows XP SP1),您可以使用
否则您必须使用。如果您不支持旧的Windows版本(早于Windows XP SP1),您可以使用 否则你必须使用。一些有用的东西-一些有用的东西-