ProcMem for multiple processes
This commit is contained in:
parent
79e50a55ba
commit
54dbe31c62
|
@ -0,0 +1,25 @@
|
|||
package net.hyperic.sigar;
|
||||
|
||||
import net.hyperic.sigar.ptql.ProcessFinder;
|
||||
|
||||
public class MultiProcMem extends ProcMem {
|
||||
|
||||
static ProcMem get(Sigar sigar, String query)
|
||||
throws SigarException {
|
||||
|
||||
ProcMem mem = new ProcMem();
|
||||
|
||||
long[] pids = ProcessFinder.find(sigar, query);
|
||||
|
||||
for (int i=0; i<pids.length; i++) {
|
||||
ProcMem pmem = sigar.getProcMem(pids[i]);
|
||||
mem.size += pmem.size;
|
||||
mem.vsize += pmem.vsize;
|
||||
mem.resident += pmem.resident;
|
||||
mem.share += pmem.share;
|
||||
mem.rss += pmem.rss;
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue