check that mem.share is valid

This commit is contained in:
Doug MacEachern 2007-10-24 00:19:01 +00:00
parent 26139ee50f
commit 2b39b1228e
1 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ public class MultiProcMem extends ProcMem {
throws SigarException {
ProcMem mem = new ProcMem();
mem.share = Sigar.FIELD_NOTIMPL;
long[] pids = ProcessFinder.find(sigar, query);
@ -33,7 +34,9 @@ public class MultiProcMem extends ProcMem {
ProcMem pmem = sigar.getProcMem(pids[i]);
mem.size += pmem.size;
mem.resident += pmem.resident;
mem.share += pmem.share;
if (pmem.share != Sigar.FIELD_NOTIMPL) {
mem.share += pmem.share;
}
}
return mem;