@Test public void testGetNodeCpuInfoFunction() { assertEquals(ArrayList.class, provider.getNodeCpuInfos().getClass()); assert(provider.getNodeCpuInfos() != null); }
public List<Map<Object, Object>> getNodeCpuInfos() { List<Map<Object, Object>> nodeCpuInfoList = new ArrayList<Map<Object, Object>>(); Cpu[] cpuList = null; CpuInfo[] cpuInfoList = null; Map<Object, Object> nodeCpuInfo = null; try { cpuList = sigar.getCpuList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } try { cpuInfoList = sigar.getCpuInfoList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (int i = 0; i < cpuList.length; i++) { nodeCpuInfo = new HashMap<Object, Object>(); nodeCpuInfo.put("vendor", cpuInfoList[i].getVendor()); nodeCpuInfo.put("clock", cpuInfoList[i].getMhz()); nodeCpuInfo.put("model", cpuInfoList[i].getModel()); nodeCpuInfo.put("cores", cpuInfoList[i].getTotalCores()); nodeCpuInfo.put("coresPerSocket", cpuInfoList[i].getCoresPerSocket()); nodeCpuInfo.put("sockets", cpuInfoList[i].getTotalSockets()); nodeCpuInfo.put("cacheSize", cpuInfoList[i].getCacheSize()); nodeCpuInfo.put("idleTime", cpuList[i].getIdle()); nodeCpuInfo.put("interruptHandlingTime", cpuList[i].getIrq()); nodeCpuInfo.put("niceTime", cpuList[i].getNice()); nodeCpuInfo.put("softRequestTime", cpuList[i].getSoftIrq()); nodeCpuInfo.put("kernelTime", cpuList[i].getSys()); nodeCpuInfo.put("cpuTime", cpuList[i].getTotal()); nodeCpuInfo.put("userTime", cpuList[i].getUser()); nodeCpuInfo.put("waitTime", cpuList[i].getWait()); nodeCpuInfoList.add(nodeCpuInfo); } return nodeCpuInfoList; }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeCpuInfos() { List<Map<Object, Object>> nodeCpuInfoList = new ArrayList<Map<Object, Object>>(); Cpu[] cpuList = null; CpuInfo[] cpuInfoList = null; Map<Object, Object> nodeCpuInfo = null; try { cpuList = sigar.getCpuList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } try { cpuInfoList = sigar.getCpuInfoList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (int i = 0; i < cpuList.length; i++) { nodeCpuInfo = new HashMap<Object, Object>(); nodeCpuInfo.put("vendor", cpuInfoList[i].getVendor()); nodeCpuInfo.put("clock", cpuInfoList[i].getMhz()); nodeCpuInfo.put("model", cpuInfoList[i].getModel()); nodeCpuInfo.put("cores", cpuInfoList[i].getTotalCores()); nodeCpuInfo.put("coresPerSocket", cpuInfoList[i].getCoresPerSocket()); nodeCpuInfo.put("sockets", cpuInfoList[i].getTotalSockets()); nodeCpuInfo.put("cacheSize", cpuInfoList[i].getCacheSize()); nodeCpuInfo.put("idleTime", cpuList[i].getIdle()); nodeCpuInfo.put("interruptHandlingTime", cpuList[i].getIrq()); nodeCpuInfo.put("niceTime", cpuList[i].getNice()); nodeCpuInfo.put("softRequestTime", cpuList[i].getSoftIrq()); nodeCpuInfo.put("kernelTime", cpuList[i].getSys()); nodeCpuInfo.put("cpuTime", cpuList[i].getTotal()); nodeCpuInfo.put("userTime", cpuList[i].getUser()); nodeCpuInfo.put("waitTime", cpuList[i].getWait()); nodeCpuInfoList.add(nodeCpuInfo); } return nodeCpuInfoList; } }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeCpuInfos() { List<Map<Object, Object>> nodeCpuInfoList = new ArrayList<Map<Object, Object>>(); Cpu[] cpuList = null; CpuInfo[] cpuInfoList = null; Map<Object, Object> nodeCpuInfo = null; try { cpuList = sigar.getCpuList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } try { cpuInfoList = sigar.getCpuInfoList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (int i = 0; i < cpuList.length; i++) { nodeCpuInfo = new HashMap<Object, Object>(); nodeCpuInfo.put("vendor", cpuInfoList[i].getVendor()); nodeCpuInfo.put("clock", cpuInfoList[i].getMhz()); nodeCpuInfo.put("model", cpuInfoList[i].getModel()); nodeCpuInfo.put("cores", cpuInfoList[i].getTotalCores()); nodeCpuInfo.put("coresPerSocket", cpuInfoList[i].getCoresPerSocket()); nodeCpuInfo.put("sockets", cpuInfoList[i].getTotalSockets()); nodeCpuInfo.put("cacheSize", cpuInfoList[i].getCacheSize()); nodeCpuInfo.put("idleTime", cpuList[i].getIdle()); nodeCpuInfo.put("interruptHandlingTime", cpuList[i].getIrq()); nodeCpuInfo.put("niceTime", cpuList[i].getNice()); nodeCpuInfo.put("softRequestTime", cpuList[i].getSoftIrq()); nodeCpuInfo.put("kernelTime", cpuList[i].getSys()); nodeCpuInfo.put("cpuTime", cpuList[i].getTotal()); nodeCpuInfo.put("userTime", cpuList[i].getUser()); nodeCpuInfo.put("waitTime", cpuList[i].getWait()); nodeCpuInfoList.add(nodeCpuInfo); } return nodeCpuInfoList; } SigarNodeInfoProvider(); }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeCpuInfos() { List<Map<Object, Object>> nodeCpuInfoList = new ArrayList<Map<Object, Object>>(); Cpu[] cpuList = null; CpuInfo[] cpuInfoList = null; Map<Object, Object> nodeCpuInfo = null; try { cpuList = sigar.getCpuList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } try { cpuInfoList = sigar.getCpuInfoList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (int i = 0; i < cpuList.length; i++) { nodeCpuInfo = new HashMap<Object, Object>(); nodeCpuInfo.put("vendor", cpuInfoList[i].getVendor()); nodeCpuInfo.put("clock", cpuInfoList[i].getMhz()); nodeCpuInfo.put("model", cpuInfoList[i].getModel()); nodeCpuInfo.put("cores", cpuInfoList[i].getTotalCores()); nodeCpuInfo.put("coresPerSocket", cpuInfoList[i].getCoresPerSocket()); nodeCpuInfo.put("sockets", cpuInfoList[i].getTotalSockets()); nodeCpuInfo.put("cacheSize", cpuInfoList[i].getCacheSize()); nodeCpuInfo.put("idleTime", cpuList[i].getIdle()); nodeCpuInfo.put("interruptHandlingTime", cpuList[i].getIrq()); nodeCpuInfo.put("niceTime", cpuList[i].getNice()); nodeCpuInfo.put("softRequestTime", cpuList[i].getSoftIrq()); nodeCpuInfo.put("kernelTime", cpuList[i].getSys()); nodeCpuInfo.put("cpuTime", cpuList[i].getTotal()); nodeCpuInfo.put("userTime", cpuList[i].getUser()); nodeCpuInfo.put("waitTime", cpuList[i].getWait()); nodeCpuInfoList.add(nodeCpuInfo); } return nodeCpuInfoList; } SigarNodeInfoProvider(); Map<Object, Object> getNodeMemoryInfo(); List<Map<Object, Object>> getNodeCpuInfos(); Map<Object, Object> getNodeSwapInfo(); List<Map<Object, Object>> getNodeNetworkInfos(); Map<Object, Object> getNodeOSInfo(); Map<Object, Object> getNodeUpTimeInfo(); List<Map<Object, Object>> getNodeDiskInfos(); List<Map<Object, Object>> getSortedListByItem(final String item); Map<String, Object> getNodeInfo(int topProcessCount); }
SigarNodeInfoProvider { public List<Map<Object, Object>> getNodeCpuInfos() { List<Map<Object, Object>> nodeCpuInfoList = new ArrayList<Map<Object, Object>>(); Cpu[] cpuList = null; CpuInfo[] cpuInfoList = null; Map<Object, Object> nodeCpuInfo = null; try { cpuList = sigar.getCpuList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } try { cpuInfoList = sigar.getCpuInfoList(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } for (int i = 0; i < cpuList.length; i++) { nodeCpuInfo = new HashMap<Object, Object>(); nodeCpuInfo.put("vendor", cpuInfoList[i].getVendor()); nodeCpuInfo.put("clock", cpuInfoList[i].getMhz()); nodeCpuInfo.put("model", cpuInfoList[i].getModel()); nodeCpuInfo.put("cores", cpuInfoList[i].getTotalCores()); nodeCpuInfo.put("coresPerSocket", cpuInfoList[i].getCoresPerSocket()); nodeCpuInfo.put("sockets", cpuInfoList[i].getTotalSockets()); nodeCpuInfo.put("cacheSize", cpuInfoList[i].getCacheSize()); nodeCpuInfo.put("idleTime", cpuList[i].getIdle()); nodeCpuInfo.put("interruptHandlingTime", cpuList[i].getIrq()); nodeCpuInfo.put("niceTime", cpuList[i].getNice()); nodeCpuInfo.put("softRequestTime", cpuList[i].getSoftIrq()); nodeCpuInfo.put("kernelTime", cpuList[i].getSys()); nodeCpuInfo.put("cpuTime", cpuList[i].getTotal()); nodeCpuInfo.put("userTime", cpuList[i].getUser()); nodeCpuInfo.put("waitTime", cpuList[i].getWait()); nodeCpuInfoList.add(nodeCpuInfo); } return nodeCpuInfoList; } SigarNodeInfoProvider(); Map<Object, Object> getNodeMemoryInfo(); List<Map<Object, Object>> getNodeCpuInfos(); Map<Object, Object> getNodeSwapInfo(); List<Map<Object, Object>> getNodeNetworkInfos(); Map<Object, Object> getNodeOSInfo(); Map<Object, Object> getNodeUpTimeInfo(); List<Map<Object, Object>> getNodeDiskInfos(); List<Map<Object, Object>> getSortedListByItem(final String item); Map<String, Object> getNodeInfo(int topProcessCount); static final char SLEEP; static final char RUN; static final char STOP; static final char ZOMBIE; static final char IDLE; static final int HUNDRED; static final int NUMBER_1024; }