zoukankan      html  css  js  c++  java
  • 获取网卡速率,cpu使用率

       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") + "%";
  • 相关阅读:
    tcp/ip的通俗讲述(转)
    linux中的read_link
    浅拷贝和深拷贝
    JAVA的动态代理Jdk实现方式
    友元函数
    孤儿进程、僵尸进程
    waitpid()函数
    wait()函数
    dup2函数
    exec族函数
  • 原文地址:https://www.cnblogs.com/qc-id-01/p/9922715.html
Copyright © 2011-2022 走看看