//
PerformanceCounter:
static void Main(string[] args)
{
PerformanceCounter pc = new PerformanceCounter("Processor", "% Processor Time", "_Total");
while(true)
{
Thread.Sleep(1000);
float cpuLoad = pc.NextValue();
Console.WriteLine("cpu使用率:"+cpuLoad);
}
}