Package org.rioproject.system.measurable.cpu

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


        if(cru==null)
            return "?";

       if(includeSystemInfo) {
            if(cName.equals(Constants.UTIL_PERCENT_CPU)) {
                CpuUtilization cpu = cru.getCpuUtilization();
                value = (cpu == null ? "?" : formatPercent(cpu.getValue()));

            } else if(cName.equals(Constants.UTIL_PERCENT_MEMORY)) {
                SystemMemoryUtilization mem = cru.getSystemMemoryUtilization();
                value = (mem == null ? "?" : formatPercent(mem.getValue()));
View Full Code Here


    public void setThresholdValues(ThresholdValues tVals) {
        this.tVals = tVals;
    }

    public CpuUtilization getMeasuredResource() {
        return (new CpuUtilization(id, getValue(), tVals));
    }
View Full Code Here

    public void setThresholdValues(ThresholdValues tVals) {
        this.tVals = tVals;
    }

    public CpuUtilization getMeasuredResource() {
        return (new CpuUtilization(id, getSystemUtilization(), tVals));
    }
View Full Code Here

    @SuppressWarnings("unused")
    static double getMeasuredResourceValue(final String cName,
                                           final ComputeResourceUtilization cru) {
        double value = 0;
        if (cName.equals(Constants.UTIL_PERCENT_CPU)) {
            CpuUtilization cpu = cru.getCpuUtilization();
            value = (cpu == null ? 0 : cpu.getValue());

        } else if (cName.equals(Constants.UTIL_PERCENT_MEMORY)) {
            SystemMemoryUtilization mem = cru.getSystemMemoryUtilization();
            value = (mem == null ? 0 : mem.getValue());
View Full Code Here

    public void setThresholdValues(ThresholdValues tVals) {
        this.tVals = tVals;
    }

    public CpuUtilization getMeasuredResource() {
        return (new CpuUtilization(id, getCpuUtilization(), tVals));
    }
View Full Code Here

        if(altMonitor!=null)
            altMonitor.setThresholdValues(tVals);
    }

    public CpuUtilization getMeasuredResource() {
        CpuUtilization util;
        if(sigar!=null) {
            util = getSigarCpuUtilization();
        } else {
            if(jmxCPUUtilization!=null) {
                util = getJmxCpuUtilization();
View Full Code Here

        if(altMonitor!=null)
            altMonitor.terminate();
    }

    private CpuUtilization getSigarCpuUtilization() {
        return new CpuUtilization(id,
                                   sigar.getSystemCpuPercentage(),
                                   sigar.getUserCpuPercentage(),
                                   sigar.getLoadAverage(),
                                   Runtime.getRuntime().availableProcessors(),
                                   tVals);
View Full Code Here

            cpuUtilization = (Double)jmxCPUUtilization.invoke(opSysMBean);
            cpuUtilization = (cpuUtilization>0?cpuUtilization/100:cpuUtilization);
        } catch (Exception e) {
            logger.warn("Could not get SystemloadAverage using reflection on OperatingSystemMXBean.getSystemLoadAverage()", e);
        }
        return new CpuUtilization(id, cpuUtilization, tVals);
    }
View Full Code Here

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

TOP

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

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.