Reputation: 2824
We had a Java app that showed 100% CPU usage all the time. I was trying to find out if there were a few dominating threads when I noticed some strange results with the top
command.
If I run top
, it showed one java process that had the 100% CPU time. Then I typed H
to show threads, it started with showing several Java threads each with 100%. However, the next refresh, it showed a different batch of several Java threads again each with 100% CPU. The next refresh, another batch. This went on and on with several refresh cycles going through 100 or so threads of 100% CPU. Finally it settled down with a dozen or so Java threads each had about 10% CPU time. This "final" set of threads were the same threads that showed 100% CPU time once at the beginning but now they each had 10% only. If run top -H
directly, I got to the final set directly.
My intuition is that the 100% CPU for the Java threads was somewhat bogus. But I just couldn't find an explanation for it.
I am on a Debian Wheezy box.
Upvotes: 2
Views: 2010
Reputation: 11
With perl threads I've gotten well over 100%, so I think top is definitely not thread aware.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19841 v807576 15 0 402m 13m 2184 S 498.7 0.1 9:14.71 mt_analyze_ets
Actually not true. With the -H option I get this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+COMMAND
18118 v807576 18 0 653m 22m 2164 R 96.3 0.1 0:02.98 mt_analyze_et
18124 v807576 18 0 653m 22m 2164 R 96.3 0.1 0:02.98 mt_analyze_ets
18117 v807576 18 0 653m 22m 2164 R 95.3 0.1 0:02.95 mt_analyze_ets
18121 v807576 18 0 653m 22m 2164 R 94.7 0.1 0:02.93 mt_analyze_ets
18127 v807576 18 0 653m 22m 2164 R 94.3 0.1 0:02.92 mt_analyze_ets
18133 v807576 18 0 653m 22m 2164 R 94.3 0.1 0:02.92 mt_analyze_ets
18136 v807576 18 0 653m 22m 2164 R 94.3 0.1 0:02.92 mt_analyze_ets
18145 v807576 18 0 653m 22m 2164 R 94.0 0.1 0:02.91 mt_analyze_ets
18142 v807576 18 0 653m 22m 2164 R 93.1 0.1 0:02.88 mt_analyze_ets
18130 v807576 18 0 653m 22m 2164 R 92.1 0.1 0:02.85 mt_analyze_ets
18148 v807576 18 0 653m 22m 2164 R 90.8 0.1 0:02.81 mt_analyze_ets
18116 v807576 18 0 653m 22m 2164 S 5.2 0.1 0:00.16 mt_analyze_ets
Upvotes: 1