[SIGAR-106] Add cpu irq, soft_irq and steal
This commit is contained in:
1 parent
e3510e0805
commit
9a1f45cd7b
12 files changed
+118
-9
No files matched your search
@@ -23,13 +23,16 @@ package org.hyperic.sigar;
|
||||
*/
|
||||
public class CpuPerc implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 02242007L;
|
||||
private static final long serialVersionUID = 05242007L;
|
||||
|
||||
private double user;
|
||||
private double sys;
|
||||
private double nice;
|
||||
private double idle;
|
||||
private double wait;
|
||||
private double irq;
|
||||
private double softIrq;
|
||||
private double steal;
|
||||
private double combined;
|
||||
|
||||
CpuPerc() {}
|
||||
@@ -74,6 +77,18 @@ public class CpuPerc implements java.io.Serializable {
|
||||
return this.wait;
|
||||
}
|
||||
|
||||
public double getIrq() {
|
||||
return this.irq;
|
||||
}
|
||||
|
||||
public double getSoftIrq() {
|
||||
return this.softIrq;
|
||||
}
|
||||
|
||||
public double getSteal() {
|
||||
return this.steal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Sum of User + Sys + Nice + Wait
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.hyperic.sigar.cmd;
|
||||
|
||||
import org.hyperic.sigar.CpuPerc;
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarLoader;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,11 @@ public class CpuInfo extends SigarCommandBase {
|
||||
println("Wait Time....." + CpuPerc.format(cpu.getWait()));
|
||||
println("Nice Time....." + CpuPerc.format(cpu.getNice()));
|
||||
println("Combined......" + CpuPerc.format(cpu.getCombined()));
|
||||
if (SigarLoader.IS_LINUX) {
|
||||
println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
|
||||
println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq()));
|
||||
println("Steal Time...." + CpuPerc.format(cpu.getSteal()));
|
||||
}
|
||||
println("");
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,15 @@ public class TestCpu extends SigarTestCase {
|
||||
traceln("Wait..." + cpu.getWait());
|
||||
assertTrue(cpu.getWait() >= 0);
|
||||
|
||||
traceln("Irq..." + cpu.getIrq());
|
||||
assertTrue(cpu.getIrq() >= 0);
|
||||
|
||||
traceln("SIrq.." + cpu.getSoftIrq());
|
||||
assertTrue(cpu.getSoftIrq() >= 0);
|
||||
|
||||
traceln("Stl..." + cpu.getSteal());
|
||||
assertTrue(cpu.getSteal() >= 0);
|
||||
|
||||
traceln("Total.." + cpu.getTotal());
|
||||
assertTrue(cpu.getTotal() > 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user