add MultiProcMem wrappers

This commit is contained in:
Doug MacEachern 2004-11-10 23:38:39 +00:00
parent 54dbe31c62
commit 80a7b7879e
4 changed files with 19 additions and 0 deletions

View File

@ -279,6 +279,10 @@ public class Sigar implements SigarProxy {
return getProcMem(convertPid(pid));
}
public ProcMem getMultiProcMem(String query) throws SigarException {
return MultiProcMem.get(this, query);
}
/**
* Get process state info.
* @param pid The process id.

View File

@ -35,6 +35,8 @@ public interface SigarProxy {
public ProcMem getProcMem(String pid) throws SigarException;
public ProcMem getMultiProcMem(String query) throws SigarException;
public ProcState getProcState(long pid) throws SigarException;
public ProcState getProcState(String pid) throws SigarException;

View File

@ -131,6 +131,12 @@ public class SynchronizedSigar implements SigarProxy {
return this.sigar.getMultiProcCpu(query);
}
public ProcMem getMultiProcMem(String query)
throws SigarException
{
return this.sigar.getMultiProcMem(query);
}
public synchronized ProcCred getProcCred(long pid)
throws SigarException
{

View File

@ -5,6 +5,7 @@ import net.hyperic.sigar.SigarProxy;
import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.CpuPerc;
import net.hyperic.sigar.MultiProcCpu;
import net.hyperic.sigar.ProcMem;
/**
* Show multi process status.
@ -41,6 +42,12 @@ public class MultiPs extends SigarCommandBase {
println("Number of processes: " + cpu.getProcesses());
println("Cpu usage: " + CpuPerc.format(cpu.getPercent()));
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 {