Examples of Uptime


Examples of org.hyperic.sigar.Uptime

    CpuInfo[] cpuinfo = null;
    CpuPerc[] cpuPerc = null;
    Mem mem = null;
    FileSystem[] fs = null;
    String[] netIf = null;
    Uptime uptime = null;
    double[] loadavg = null;
    JSONObject json = new JSONObject();
    try {
      // CPU utilization
      cpuinfo = sigar.getCpuInfoList();
      cpuPerc = sigar.getCpuPercList();
      JSONArray cpuList = new JSONArray();
      for (int i = 0; i < cpuinfo.length; i++) {
        JSONObject cpuMap = new JSONObject();
        cpuMap.putAll(cpuinfo[i].toMap());
        cpuMap.put("combined", cpuPerc[i].getCombined());
        cpuMap.put("user", cpuPerc[i].getUser());
        cpuMap.put("sys", cpuPerc[i].getSys());
        cpuMap.put("idle", cpuPerc[i].getIdle());
        cpuMap.put("wait", cpuPerc[i].getWait());
        cpuMap.put("nice", cpuPerc[i].getNice());
        cpuMap.put("irq", cpuPerc[i].getIrq());
        cpuList.add(cpuMap);
      }
      sigar.getCpuPerc();
      json.put("cpu", cpuList);
     
      // Uptime
      uptime = sigar.getUptime();
      json.put("uptime", uptime.getUptime());
     
      // Load Average
      loadavg = sigar.getLoadAverage();
      JSONArray load = new JSONArray();
      load.add(loadavg[0]);
View Full Code Here

Examples of org.hyperic.sigar.Uptime

    }

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

        Uptime uptime = sigar.getUptime();

        long now = System.currentTimeMillis();
        traceln("\nboottime=" +
                new Date(now - (long)uptime.getUptime()*1000));
        assertTrue(uptime.getUptime() > 0);
    }
View Full Code Here

Examples of org.hyperic.sigar.Uptime

  public List<DataEntity> buildUptimeInfo() {
    List<DataEntity> entities = new ArrayList<DataEntity>();

    try {
      Uptime uptime = m_sigar.getUptime();
      double time = uptime.getUptime() / 60;
      Map<String, Double> values = new HashMap<String, Double>();

      values.put(buildSystemId("uptime"), time);
      entities.addAll(buildEntities(values, AVG_TYPE));
    } catch (Exception e) {
View Full Code Here

Examples of org.hyperic.sigar.Uptime

    }

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

        Uptime uptime = sigar.getUptime();

        long now = System.currentTimeMillis();
        traceln("\nboottime=" +
                new Date(now - (long)uptime.getUptime()*1000));
        assertTrue(uptime.getUptime() > 0);
    }
View Full Code Here

Examples of org.hyperic.sigar.Uptime

    CpuPerc[] cpuPerc = null;
    Mem mem = null;
    Swap swap = null;
    FileSystem[] fs = null;
    String[] netIf = null;
    Uptime uptime = null;
    double[] loadavg = null;
    JSONObject json = new JSONObject();
    try {
      // CPU utilization
      cpuinfo = sigar.getCpuInfoList();
      cpuPerc = sigar.getCpuPercList();
      JSONArray cpuList = new JSONArray();
      for (int i = 0; i < cpuinfo.length; i++) {
        JSONObject cpuMap = new JSONObject();
        cpuMap.putAll(cpuinfo[i].toMap());
        cpuMap.put("combined", cpuPerc[i].getCombined());
        cpuMap.put("user", cpuPerc[i].getUser());
        cpuMap.put("sys", cpuPerc[i].getSys());
        cpuMap.put("idle", cpuPerc[i].getIdle());
        cpuMap.put("wait", cpuPerc[i].getWait());
        cpuMap.put("nice", cpuPerc[i].getNice());
        cpuMap.put("irq", cpuPerc[i].getIrq());
        cpuList.add(cpuMap);
      }
      sigar.getCpuPerc();
      json.put("cpu", cpuList);
     
      // Uptime
      uptime = sigar.getUptime();
      json.put("uptime", uptime.getUptime());
     
      // Load Average
      loadavg = sigar.getLoadAverage();
      JSONArray load = new JSONArray();
      load.add(loadavg[0]);
View Full Code Here

Examples of org.hyperic.sigar.Uptime

    }

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

        Uptime uptime = sigar.getUptime();

        assertTrue(uptime.getUptime() > 0);
    }
View Full Code Here

Examples of org.richfaces.application.Uptime

        ServicesFactoryImpl injector = new ServicesFactoryImpl();
        injector.init(Collections.<Module>singletonList(new Module() {
            public void configure(ServicesFactory injector) {
                injector.setInstance(ResourceCodec.class, mockedCodec);
                injector.setInstance(org.richfaces.cache.Cache.class, mockCache);
                injector.setInstance(Uptime.class, new Uptime());
                injector.setInstance(DependencyInjector.class, new DependencyInjectorImpl());
                injector.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
            }
        }));
        ServiceTracker.setFactory(injector);
View Full Code Here

Examples of org.richfaces.application.Uptime

        EasyMock.replay(resourceCodec);
        ServicesFactoryImpl injector = new ServicesFactoryImpl();
        injector.init(Collections.<Module>singletonList(new Module() {
            public void configure(ServicesFactory injector) {
                injector.setInstance(ResourceCodec.class, resourceCodec);
                injector.setInstance(Uptime.class, new Uptime());
            }
        }));
        ServiceTracker.setFactory(injector);

        MockStateAwareResourceImpl stateAwareResourceImpl = new MockStateAwareResourceImpl();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.