Package org.hyperic.sigar

Examples of org.hyperic.sigar.SigarProxy


        //true should make things blow up
        boolean useGlobal = false;

        public void run() {
            Sigar sigar;
            SigarProxy proxy;

            try {
                synchronized (lock) {
                    if (useGlobal) {
                        if (gSigar == null) {
View Full Code Here


    public static void main(String[] args) throws Exception {
        int expire = 30 * 1000;

        Sigar sigar = new Sigar();

        SigarProxy proxy = SigarProxyCache.newInstance(sigar, expire);

        new Proxy(sigar, proxy).run(args);
    }
View Full Code Here

        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 void testCreate() throws Exception {
        Sigar sigar = new Sigar();

        SigarProxy proxy =
            SigarProxyCache.newInstance(sigar);

        testOK(proxy);

        sigar.close();
View Full Code Here

    }

    public static void main(String[] args) throws Exception {
        Sigar sigarImpl = new Sigar();

        SigarProxy sigar =
            SigarProxyCache.newInstance(sigarImpl, SLEEP_TIME);

        while (true) {
            Shell.clearScreen();

            System.out.println(Uptime.getInfo(sigar));

            System.out.println(toString(sigar.getProcStat()));

            System.out.println(sigar.getCpuPerc());

            System.out.println(sigar.getMem());

            System.out.println(sigar.getSwap());
                              
            System.out.println();

            System.out.println(HEADER);

            long[] pids = Shell.getPids(sigar, args);

            for (int i=0; i<pids.length; i++) {
                long pid = pids[i];

                String cpuPerc = "?";

                List info;
                try {
                    info = Ps.getInfo(sigar, pid);
                } catch (SigarException e) {
                    continue; //process may have gone away
                }
                try {
                    ProcCpu cpu = sigar.getProcCpu(pid);
                    cpuPerc = CpuPerc.format(cpu.getPercent());
                } catch (SigarException e) {
                }

                info.add(info.size()-1, cpuPerc);
View Full Code Here

    }

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

        SigarProxy proxy =
            SigarProxyCache.newInstance(sigar);

        testOK(proxy);

        sigar.close();
View Full Code Here

        //conditions if the process table changes in between.
        //if this is a real problem, can just change to:
        //assertTrue(stat.getTotal() > 1);
        assertTrue(pids.length == stat.getTotal());
        traceln(stat.toString());
        SigarProxy proxy = SigarProxyCache.newInstance(getSigar());
        traceln(CurrentProcessSummary.get(proxy).toString());
    }
View Full Code Here

    }

    public static void main(String[] args) throws Exception {
        Sigar sigarImpl = new Sigar();

        SigarProxy sigar =
            SigarProxyCache.newInstance(sigarImpl, SLEEP_TIME);

        while (true) {
            Shell.clearScreen();

            System.out.println(Uptime.getInfo(sigar));

            System.out.println(toString(sigar.getProcStat()));

            System.out.println(sigar.getCpuPerc());

            System.out.println(sigar.getMem());

            System.out.println(sigar.getSwap());
                              
            System.out.println();

            System.out.println(HEADER);

            long[] pids = Shell.getPids(sigar, args);

            for (int i=0; i<pids.length; i++) {
                long pid = pids[i];

                String cpuPerc = "?";

                List info = Ps.getInfo(sigar, pid);
                try {
                    ProcCpu cpu = sigar.getProcCpu(pid);
                    cpuPerc = CpuPerc.format(cpu.getPercent());
                } catch (SigarException e) {
                }

                info.add(info.size()-1, cpuPerc);
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.SigarProxy

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.