Package org.hyperic.sigar

Examples of org.hyperic.sigar.Sigar


    public TestNetStat(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();
        NetStat netstat;
       
        try {
            netstat = sigar.getNetStat();
        } catch (SigarNotImplementedException e) {
            return;
        } catch (SigarPermissionDeniedException e) {
            return;
        }
View Full Code Here


    public TestProcStat(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        ProcStat stat = sigar.getProcStat();

        long[] pids = sigar.getProcList();

        assertTrue(stat.getTotal() > 1);
        traceln(stat.toString());
        SigarProxy proxy = SigarProxyCache.newInstance(getSigar());
        traceln(CurrentProcessSummary.get(proxy).toString());
View Full Code Here

    public TestProcList(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        ArrayList traceList = new ArrayList();

        long[] pids = sigar.getProcList();

        assertTrue(pids.length > 1);

        long pid = sigar.getPid();
        boolean foundPid = false;

        //find our pid in the process list
        for (int i=0; i<pids.length; i++) {
            traceList.add(new Long(pids[i]));
View Full Code Here

    public TestNfsClientV3(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();
        NfsClientV3 nfs;
       
        try {
            nfs = sigar.getNfsClientV3();
        } catch (SigarException e) {
            return;
        }

        traceMethods(nfs);
View Full Code Here

    public TestSwap(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        Swap swap = sigar.getSwap();

        assertGtEqZeroTrace("Total", swap.getTotal());

        assertGtEqZeroTrace("Used", swap.getUsed());
View Full Code Here

    public TestLog(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = new Sigar();
        sigar.enableLogging(true);
        sigar.enableLogging(false);
        sigar.enableLogging(true);
        sigar.close();
    }
View Full Code Here

            e.printStackTrace();
        }
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();
        Cpu cpu = sigar.getCpu();

        traceln("getCpu:");
        checkCpu(cpu);

        try {
            Cpu[] cpuList = sigar.getCpuList();

            for (int i=0; i<cpuList.length; i++) {
                traceln("Cpu " + i + ":");
                checkCpu(cpuList[i]);
            }
View Full Code Here

        if (args.length > 0) {
            interval = Integer.parseInt(args[0]);
        }
        int sleep = 1000 * 60 * interval;

        Sigar sigar = new Sigar();

        while (true) {
            System.out.println(HEADER);

            printCpu("   ", sigar.getCpuPerc());

            CpuPerc[] cpuList = sigar.getCpuPercList();

            for (int i=0; i<cpuList.length; i++) {
                printCpu(i+": ", cpuList[i]);
            }
            Thread.sleep(sleep);
View Full Code Here

            //expected
        }
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        /* call twice to make sure caching works */
        getNetIflist(sigar, false);
        getNetIflist(sigar, false);
        getNetIflist(sigar, true);
        traceln("Default IP=" +
                sigar.getNetInterfaceConfig().getAddress());

        getGarbage(sigar);
    }
View Full Code Here

            //ok
        }
    }

    public void testCreate() throws Exception {
        Sigar sigar = getSigar();

        try {
            sigar.getProcExe(getInvalidPid());
        } catch (SigarException e) {
        }

        try {
            ProcExe exe = sigar.getProcExe(sigar.getPid());

            File exeFile = new File(exe.getName());
            String cwd = exe.getCwd();
            traceln("cwd='" + cwd + "'");

            if (cwd.length() > 0) {
                assertTrue(new File(cwd).isDirectory());
            }

            traceln("exe='" + exe.getName() + "'");

            if (exe.getName().length() > 0) {
                assertTrue(exeFile.exists());

                //win32 has .exe
                assertTrue(exeFile.getName().startsWith("java"));
            }
        } catch (SigarNotImplementedException e) {
            //ok
        }

  long[] pids = sigar.getProcList();

        //go through all just to make sure no crashes
  for (int i=0; i<pids.length; i++) {
            try {
                printExe(sigar, pids[i]);
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.Sigar

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.