C#如何获得机器的CPU使用率,内存大小,内存使用率,硬盘大小和硬盘使用率等等信息

C#怎么获得机器的CPU使用率,内存大小,内存使用率,硬盘大小和硬盘使用率等等信息
C#怎么获得机器的CPU使用率,内存大小,内存使用率,硬盘大小和硬盘使用率等等信息

求代码
C#如何获得机器的CPU使用率,内存大小,内存使用率,硬盘大小和硬盘使用率等等信息
------解决思路----------------------

PerformanceCounter performanceCounter1 = new PerformanceCounter();
PerformanceCounter performanceCounter2 = new PerformanceCounter();
PerformanceCounter performanceCounter3 = new PerformanceCounter();

performanceCounter1.CategoryName = "Processor";
performanceCounter1.CounterName = "% Processor Time";
performanceCounter1.InstanceName = "_Total";

performanceCounter2.CategoryName = "Memory";
performanceCounter2.CounterName = "Committed Bytes";
performanceCounter2.InstanceName = "";

performanceCounter3.CategoryName = "Memory";
performanceCounter3.CounterName = "Available MBytes";
performanceCounter3.InstanceName = "";

//cpu
int cpuCounter = (int)performanceCounter1.NextValue();
label2.Text = cpuCounter.ToString() + "%";

//cpu_bar
this.progressBar1.Value = cpuCounter;

//memory
int memoryCounter = (int)performanceCounter2.NextValue();
int memoryCounter1 = (int)performanceCounter3.NextValue();
label1.Text = "使用:" + (memoryCounter / 1024 / 1024).ToString() + "MB / 剩余:" + memoryCounter1.ToString() + "MB";