From 2a460dbff6baa452dbfcb91731ff98d640cbae4f Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 23 Nov 2005 03:09:23 +0000 Subject: [PATCH] beef++ --- .../net/hyperic/sigar/test/TestProcState.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/test/TestProcState.java b/bindings/java/src/net/hyperic/sigar/test/TestProcState.java index 23431995..17d13f72 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestProcState.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestProcState.java @@ -10,6 +10,22 @@ public class TestProcState extends SigarTestCase { super(name); } + private void traceState(Sigar sigar, long pid) { + try { + ProcState procState = + sigar.getProcState(pid); + char state = procState.getState(); + traceln("[" + procState.getName() + "] " + + "pid=" + pid + + ",state=" + state + + ",threads=" + procState.getThreads() + + ",processor=" + procState.getProcessor() + + ",priority=" + procState.getPriority()); + } catch (SigarException e) { + traceln("pid " + pid + ": " + e.getMessage()); + } + } + public void testCreate() throws Exception { Sigar sigar = getSigar(); @@ -19,14 +35,15 @@ public class TestProcState extends SigarTestCase { } ProcState procState = sigar.getProcState(sigar.getPid()); + traceState(sigar, sigar.getPid()); + char state = procState.getState(); - traceln(procState.getName() + "=" + state); - traceln("threads=" + procState.getThreads()); - traceln("processor=" + procState.getProcessor()); - traceln("priority=" + procState.getPriority()); - assertTrue((state == 'R') || (state == 'S')); - assertTrue(procState.getName().indexOf("java") != -1); + + long[] pids = sigar.getProcList(); + for (int i=0; i