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