How to get CPU, RAM and Network-Usage of a Java7 App

后端 未结 4 754
逝去的感伤
逝去的感伤 2021-01-31 12:59

I found this older article how-to-monitor-the-computers-cpu-memory-and-disk-usage-in-java and wated to ask, if there is something new in java 7. I want to get the current CPU

4条回答
  •  太阳男子
    2021-01-31 13:28

    why cant you just use like bellow,

      try {
          for (String ni : sigar.getNetInterfaceList()) {         
            NetInterfaceStat netStat = sigar.getNetInterfaceStat(ni);   
            total+=netStat.getRxBytes();        
          }
        } catch (SigarException e) {
          e.printStackTrace();
        }
    

    what is the difference???

提交回复
热议问题