From 80a7b7879ed6278b2c3831482c353eeda9be215c Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 10 Nov 2004 23:38:39 +0000 Subject: [PATCH] add MultiProcMem wrappers --- bindings/java/src/net/hyperic/sigar/Sigar.java | 4 ++++ bindings/java/src/net/hyperic/sigar/SigarProxy.java | 2 ++ bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java | 6 ++++++ bindings/java/src/net/hyperic/sigar/cmd/MultiPs.java | 7 +++++++ 4 files changed, 19 insertions(+) diff --git a/bindings/java/src/net/hyperic/sigar/Sigar.java b/bindings/java/src/net/hyperic/sigar/Sigar.java index aaf03ef8..cf93da39 100644 --- a/bindings/java/src/net/hyperic/sigar/Sigar.java +++ b/bindings/java/src/net/hyperic/sigar/Sigar.java @@ -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. diff --git a/bindings/java/src/net/hyperic/sigar/SigarProxy.java b/bindings/java/src/net/hyperic/sigar/SigarProxy.java index 5ca25c0a..8add6ba7 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarProxy.java +++ b/bindings/java/src/net/hyperic/sigar/SigarProxy.java @@ -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; diff --git a/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java b/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java index fb90a3b6..2a5c7481 100644 --- a/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java +++ b/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java @@ -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 { diff --git a/bindings/java/src/net/hyperic/sigar/cmd/MultiPs.java b/bindings/java/src/net/hyperic/sigar/cmd/MultiPs.java index 322a6157..27530d40 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/MultiPs.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/MultiPs.java @@ -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 {