Package com.jezhumble.javasysmon

Examples of com.jezhumble.javasysmon.CpuTimes


  }
 
  public static double getCpuUsage(long time) throws ApplicationException {
    if(time<1) throw new ApplicationException("time has to be bigger than 0");
    if(jsm==null) jsm=new JavaSysMon();
    CpuTimes cput = jsm.cpuTimes();
    if(cput==null) throw new ApplicationException("CPU information are not available for this OS");
    CpuTimes previous = new CpuTimes(cput.getUserMillis(),cput.getSystemMillis(),cput.getIdleMillis());
        sleep(time);
       
        return jsm.cpuTimes().getCpuUsage(previous)*100D;
    }
View Full Code Here

TOP

Related Classes of com.jezhumble.javasysmon.CpuTimes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.