Java and ps - NPTL?
brian at krahmer.com
Tue Feb 24 18:13:53 UTC 2004
The 'time' command does show the correct results. Top shows the system-wide
values correctly (third line down, showing user, system, nice, etc.)
However, the processing time for the java process listed in top will be the
same as ps.
I wrote a very simple test program which exposes the problem perfectly. If
I do a lot of processing in the main thread, top and ps will show it at 98%
of the cpu. If I kick up 8 threads which do a lot of processing and simply
join() them from the main thread, ps and top will show 0.0%, but top's
system field will go to 98%.
[brian]$ java -version
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
More information about the test