add MultiProcMem wrappers
This commit is contained in:
parent
54dbe31c62
commit
80a7b7879e
|
@ -279,6 +279,10 @@ public class Sigar implements SigarProxy {
|
||||||
return getProcMem(convertPid(pid));
|
return getProcMem(convertPid(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProcMem getMultiProcMem(String query) throws SigarException {
|
||||||
|
return MultiProcMem.get(this, query);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get process state info.
|
* Get process state info.
|
||||||
* @param pid The process id.
|
* @param pid The process id.
|
||||||
|
|
|
@ -35,6 +35,8 @@ public interface SigarProxy {
|
||||||
|
|
||||||
public ProcMem getProcMem(String pid) throws SigarException;
|
public ProcMem getProcMem(String pid) throws SigarException;
|
||||||
|
|
||||||
|
public ProcMem getMultiProcMem(String query) throws SigarException;
|
||||||
|
|
||||||
public ProcState getProcState(long pid) throws SigarException;
|
public ProcState getProcState(long pid) throws SigarException;
|
||||||
|
|
||||||
public ProcState getProcState(String pid) throws SigarException;
|
public ProcState getProcState(String pid) throws SigarException;
|
||||||
|
|
|
@ -131,6 +131,12 @@ public class SynchronizedSigar implements SigarProxy {
|
||||||
return this.sigar.getMultiProcCpu(query);
|
return this.sigar.getMultiProcCpu(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProcMem getMultiProcMem(String query)
|
||||||
|
throws SigarException
|
||||||
|
{
|
||||||
|
return this.sigar.getMultiProcMem(query);
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized ProcCred getProcCred(long pid)
|
public synchronized ProcCred getProcCred(long pid)
|
||||||
throws SigarException
|
throws SigarException
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.hyperic.sigar.SigarProxy;
|
||||||
import net.hyperic.sigar.SigarException;
|
import net.hyperic.sigar.SigarException;
|
||||||
import net.hyperic.sigar.CpuPerc;
|
import net.hyperic.sigar.CpuPerc;
|
||||||
import net.hyperic.sigar.MultiProcCpu;
|
import net.hyperic.sigar.MultiProcCpu;
|
||||||
|
import net.hyperic.sigar.ProcMem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show multi process status.
|
* Show multi process status.
|
||||||
|
@ -41,6 +42,12 @@ public class MultiPs extends SigarCommandBase {
|
||||||
println("Number of processes: " + cpu.getProcesses());
|
println("Number of processes: " + cpu.getProcesses());
|
||||||
println("Cpu usage: " + CpuPerc.format(cpu.getPercent()));
|
println("Cpu usage: " + CpuPerc.format(cpu.getPercent()));
|
||||||
println("Cpu time: " + Ps.getCpuTime(cpu));
|
println("Cpu time: " + Ps.getCpuTime(cpu));
|
||||||
|
|
||||||
|
ProcMem mem = this.proxy.getMultiProcMem(query);
|
||||||
|
println("Size: " + Sigar.formatSize(mem.getSize()));
|
||||||
|
println("Vsize: " + Sigar.formatSize(mem.getVsize()));
|
||||||
|
println("Rss: " + Sigar.formatSize(mem.getRss()));
|
||||||
|
println("Share: " + Sigar.formatSize(mem.getShare()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue