static string NetworkName = new PerformanceCounterCategory("Network Interface").GetInstanceNames()[0];//获取网卡名称
        PerformanceCounter NetworkR = new PerformanceCounter("Network Interface", "Bytes Received/sec", NetworkName);//获取网络接收速度
        PerformanceCounter NetworkS = new PerformanceCounter("Network Interface", "Bytes Sent/sec", NetworkName);
        PerformanceCounter cpu = new PerformanceCounter("Processor", "% Processor Time", "_Total");///CPU性能计数器



  toolStripStatusLabel3.Text = "接收:" + (NetworkR.NextValue() / 1024 / 1024).ToString("0.00") + "mb/s  发送:" + (NetworkS.NextValue() / 1024 / 1024).ToString("0.00") + "mb/s";
            toolStripStatusLabel5.Text = "CPU:" + cpu.NextValue().ToString("0") + "%";

 

相关文章:

  • 2021-05-03
  • 2021-11-04
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2021-07-17
  • 2021-06-05
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案