@Override public Double getValue() { return getSnapshot().getNice() * 100.0; } });
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);
private void output(CpuPerc cpu) { println("User Time....." + CpuPerc.format(cpu.getUser())); println("Sys Time......" + CpuPerc.format(cpu.getSys())); println("Idle Time....." + CpuPerc.format(cpu.getIdle())); println("Wait Time....." + CpuPerc.format(cpu.getWait())); println("Nice Time....." + CpuPerc.format(cpu.getNice())); println("Combined......" + CpuPerc.format(cpu.getCombined())); println("Irq Time......" + CpuPerc.format(cpu.getIrq())); if (SigarLoader.IS_LINUX) { println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq())); println("Stolen Time...." + CpuPerc.format(cpu.getStolen())); } println(""); }
@Override public Double getValue() { return getSnapshot().getNice() * 100.0; } });
public static CpuTime fromSigarBean(CpuPerc cp) { return new CpuTime( // cp.getUser(), cp.getSys(), // cp.getNice(), cp.getWait(), // cp.getIdle(), cp.getIrq()); }
cpuMap.put("idle", cpuPerc[i].getIdle() * 100); cpuMap.put("wait", cpuPerc[i].getWait() * 100); cpuMap.put("nice", cpuPerc[i].getNice() * 100); cpuMap.put("irq", cpuPerc[i].getIrq() * 100); cpuList.add(cpuMap);
break; case NICE: val = cpu.getNice(); break; case SOFTIRQ:
break; case NICE: val = cpu.getNice(); break; case SOFTIRQ:
/** * {@inheritDoc} */ @Override public void sample(final IMonitoringController monitoringController) throws SigarException { if (!monitoringController.isMonitoringEnabled()) { return; } if (!monitoringController.isProbeActivated(SignatureFactory.createCPUSignature())) { return; } final CpuPerc[] cpus = this.sigar.getCpuPercList(); final ITimeSource timesource = monitoringController.getTimeSource(); for (int i = 0; i < cpus.length; i++) { if (monitoringController.isProbeActivated(SignatureFactory.createCPUSignature(i))) { final CpuPerc curCPU = cpus[i]; // final double combinedUtilization = curCPU.getCombined(); final CPUUtilizationRecord r = new CPUUtilizationRecord(timesource.getTime(), monitoringController.getHostname(), Integer.toString(i), curCPU.getUser(), curCPU.getSys(), curCPU.getWait(), curCPU.getNice(), curCPU.getIrq(), curCPU.getCombined(), curCPU.getIdle()); monitoringController.newMonitoringRecord(r); // CPUsDetailedPercSampler.log.info("Sigar utilization: " + combinedUtilization + "; " + " Record: " + r); } } } }
/** * {@inheritDoc} */ @Override public void sample(final IMonitoringController monitoringController) throws SigarException { if (!monitoringController.isMonitoringEnabled()) { return; } if (!monitoringController.isProbeActivated(SignatureFactory.createCPUSignature())) { return; } final CpuPerc[] cpus = this.sigar.getCpuPercList(); final ITimeSource timesource = monitoringController.getTimeSource(); for (int i = 0; i < cpus.length; i++) { if (monitoringController.isProbeActivated(SignatureFactory.createCPUSignature(i))) { final CpuPerc curCPU = cpus[i]; // final double combinedUtilization = curCPU.getCombined(); final CPUUtilizationRecord r = new CPUUtilizationRecord(timesource.getTime(), monitoringController.getHostname(), Integer.toString(i), curCPU.getUser(), curCPU.getSys(), curCPU.getWait(), curCPU.getNice(), curCPU.getIrq(), curCPU.getCombined(), curCPU.getIdle()); monitoringController.newMonitoringRecord(r); // CPUsDetailedPercSampler.log.info("Sigar utilization: " + combinedUtilization + "; " + " Record: " + r); } } } }
public CPU(int index, CpuInfo info, CpuPerc perc) { this.index = index; this.cacheSize = info.getCacheSize(); this.coresPerSocket = info.getCoresPerSocket(); this.totalCores = info.getTotalCores(); this.totalSockets = info.getTotalSockets(); this.mhz = info.getMhz(); this.model = info.getModel(); this.vendor = info.getVendor(); this.user = perc.getUser(); this.sys = perc.getSys(); this.nice = perc.getNice(); this.idle = perc.getIdle(); this.wait = perc.getWait(); this.irq = perc.getIrq(); this.softIrq = perc.getSoftIrq(); this.stolen = perc.getStolen(); this.combined = perc.getCombined(); }
@Check public CPUEvent getCPU() { final CPUEvent cpuEvent = new CPUEvent(); final SigarProxy instance = SystemInstance.get().getComponent(SigarProxy.class); if (instance == null) { return null; } final CPU cpu = new CPU(); try { cpuEvent.setCategory("cpu"); cpuEvent.setSubCategory(instance.getCpuInfoList()[0].getModel()); cpu .setCombinedPercent(instance.getCpuPerc().getCombined() * 100) .setIdleTimePercent(instance.getCpuPerc().getIdle() * 100) .setIrqTimePercent(instance.getCpuPerc().getIrq() * 100) .setNiceTimePercent(instance.getCpuPerc().getNice() * 100) .setSoftIrqPercent(instance.getCpuPerc().getSoftIrq() * 100) .setStolenTimePercent(instance.getCpuPerc().getStolen() * 100) .setSysTimePercent(instance.getCpuPerc().getSys() * 100) .setUserTimePercent(instance.getCpuPerc().getUser() * 100) .setWaitTimePercent(instance.getCpuPerc().getWait() * 100); cpuEvent .setModel(instance.getCpuInfoList()[0].getModel()) .setCpu(cpu); } catch (final SigarException e) { LOGGER.log(LOG_LEVEL, "Error getting cpu metrics from Sigar", e); } return !Double.isNaN(cpu.getUserTimePercent()) ? cpuEvent : null; }