Package org.rioproject.system.measurable.cpu

Examples of org.rioproject.system.measurable.cpu.ProcessCpuUtilization


    public void terminate() {
    }

    private synchronized ProcessCpuUtilization getUtilization() {
        ProcessCpuUtilization pCpu;
        if (sigar!=null) {
            try {
                /* On rare occasions the percentage has been a negative value,
                 * always make sure its a postive value */
                double percent = Math.abs(sigar.getProcessCpuPercentage(pid));
                long sys = sigar.getProcessCpuSys(pid);
                long user = sigar.getProcessCpuUser(pid);
                //System.out.println("User time....." + user);
                //System.out.println("Sys time......" + sys);
                //System.out.println("Percent......." + percent);
                //System.out.println("------------")
                pCpu = new ProcessCpuUtilization(id, percent, sys, user, tVals);
            } catch(Exception e) {
                logger.warn("SIGAR exception getting ProcessCpu, get CPU process utilization using JMX", e);
                double percent = getUtilizationUsingJMX();
                pCpu = new ProcessCpuUtilization(id, percent, tVals);
            }
        } else {
            double percent = getUtilizationUsingJMX();
            pCpu = new ProcessCpuUtilization(id, percent, tVals);
        }

        return pCpu;
    }
View Full Code Here


     * @return The latest
     * {@link org.rioproject.system.measurable.cpu.ProcessCpuUtilization}
     * taken from the compute resource. If not available, return null.
     */
    public ProcessCpuUtilization getProcessCpuUtilization() {
        ProcessCpuUtilization pCpu = null;
        for (MeasuredResource m : mRes) {
            if(m instanceof ProcessCpuUtilization) {
                pCpu = (ProcessCpuUtilization)m;
                break;
            }
View Full Code Here

TOP

Related Classes of org.rioproject.system.measurable.cpu.ProcessCpuUtilization

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.