Package org.rioproject.impl.system.measurable.cpu

Examples of org.rioproject.impl.system.measurable.cpu.CPU


                memMonitor.setMXBean(null);
            }

            memory.start();

            cpu = new CPU(config, SystemWatchID.PROC_CPU, true);
            ProcessCPUHandler cpuMonitor = (ProcessCPUHandler)cpu.getMeasurableMonitor();
            cpuMonitor.setPID(pidToUse);
            OperatingSystemMXBean opSys =
                getPlatformMXBeanProxy(mbsc,
                                       ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
View Full Code Here


        org.rioproject.impl.system.measurable.memory.Memory memory =
            getCapability(org.rioproject.impl.system.measurable.memory.Memory.class, mCaps);
        Assert.assertNotNull(memory);
        log(memory);

        CPU cpu = getCapability(CPU.class, "CPU", mCaps);
        Assert.assertNotNull(cpu);
        log(cpu);

        CPU cpuProc = getCapability(CPU.class, "CPU (Proc)", mCaps);
        Assert.assertNotNull(cpuProc);
        log(cpuProc);

        DiskSpace diskSpace = getCapability(DiskSpace.class, mCaps);
        Assert.assertNotNull(diskSpace);
View Full Code Here

        } catch(ConfigurationException e) {
            logger.warn("Loading CPU MeasurableCapability", e);
        }

        /* Create the CPU MeasurableCapability */
        MeasurableCapability cpu = new CPU(config);
        if(cpu.isEnabled())
            measurables.add(cpu);

        MeasurableCapability jvmCpu = new CPU(config, SystemWatchID.PROC_CPU, true);
        if(jvmCpu.isEnabled())
            measurables.add(jvmCpu);


        /*
         * Load the DiskSpace capability only if we have SIGAR or if SIGAR is
View Full Code Here

    public void checkNotWindows() {
        Assume.assumeTrue(!System.getProperty("os.name").startsWith("Windows"));
    }
    @Test
    public void createAndVerifyCPUClassWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        cpu.start();
        cpu.checkValue();
        MeasuredResource mRes = cpu.getMeasuredResource();
        Assert.assertTrue("MeasuredResource should not be null", mRes!=null);
        Assert.assertTrue("MeasuredResource should be a CPUUtilization", mRes instanceof CpuUtilization);
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
    }
View Full Code Here

        Assert.assertTrue("Utilization should be > 0", utilization>0);
    }

    @Test
    public void createAndVerifyCPUWithLowerThresholdBeingCrossedWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        ThresholdValues tVals = new ThresholdValues(0.30, 0.90);
        cpu.setThresholdValues(tVals);
        SimpleThresholdListener l = new SimpleThresholdListener();
        cpu.start();
        cpu.checkValue();
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
        Assert.assertTrue(l.getType()== null);
    }
View Full Code Here

    public void checkSigar() {
        Assert.assertTrue(SigarHelper.sigarAvailable());
    }
    @Test
    public void createAndVerifyCPUClassWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        Assert.assertTrue(SigarHelper.sigarAvailable());
        cpu.start();
        cpu.checkValue();
        MeasuredResource mRes = cpu.getMeasuredResource();
        Assert.assertTrue("MeasuredResource should not be null", mRes!=null);
        Assert.assertTrue("MeasuredResource should be a CPUUtilization", mRes instanceof CpuUtilization);
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
    }
View Full Code Here

        Assert.assertTrue(l.getType()== null);
    }

    @Test
    public void createAndVerifyCPUWithUpperThresholdBeingCrossedWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        ThresholdValues tVals = new ThresholdValues(0.00, 0.05);
        cpu.setThresholdValues(tVals);
        SimpleThresholdListener l = new SimpleThresholdListener();
        cpu.start();
        cpu.checkValue();
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
        Assert.assertTrue(l.getType()==null);
    }
View Full Code Here

        Assert.assertTrue("Utilization should be > 0", utilization>0);
    }

    @Test
    public void createAndVerifyCPUWithLowerThresholdBeingCrossedWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        ThresholdValues tVals = new ThresholdValues(0.30, 0.90);
        cpu.setThresholdValues(tVals);
        SimpleThresholdListener l = new SimpleThresholdListener();
        cpu.start();
        cpu.checkValue();
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
        Assert.assertTrue(l.getType()== null);
    }
View Full Code Here

        Assert.assertTrue(l.getType()== null);
    }

    @Test
    public void createAndVerifyCPUWithUpperThresholdBeingCrossedWithSigar() {
        CPU cpu = new CPU(EmptyConfiguration.INSTANCE);
        ThresholdValues tVals = new ThresholdValues(0.00, 0.05);
        cpu.setThresholdValues(tVals);
        SimpleThresholdListener l = new SimpleThresholdListener();
        cpu.start();
        cpu.checkValue();
        double utilization = cpu.getUtilization();
        Assert.assertTrue("Utilization should be > 0", utilization>0);
        Assert.assertTrue(l.getType()==null);
    }
View Full Code Here

        MeasurableCapability memory = new Memory(config);
        if(memory.isEnabled())
            measurables.add(memory);

        try{
            MeasurableCapability cpu = new CPU(config, SystemWatchID.PROC_CPU, true);
            if(cpu.isEnabled())
                measurables.add(cpu);
        } catch (RuntimeException e) {
            logger.warn("JVM CPU monitoring not supported");
        }
        return measurables.toArray(new MeasurableCapability[measurables.size()]);
View Full Code Here

TOP

Related Classes of org.rioproject.impl.system.measurable.cpu.CPU

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.