Background:
After running the test program, the top command discovers that a process (PID) consumes 100% CPU.
See which thread is consuming the most resources:
PS MP Pid-o Thread,tid, command to see all the thread usage under this process.
found that thread 324 occupies the most.
Use JSTACK for tracking:
Jstack pid for viewing output to temp file
Jstack 324> Test
Convert the most CPU-intensive thread ID (324) to 16 binary, 324== "144
To view Jstack generated files:
Below you can see which line of code is causing the line of code to see the dead loop. The trace is resolved.
The above is a look at CPU usage, extrapolate, other related resource analysis methods should be similar.
This kind of check up the problem to have a sense of accomplishment, with our cattle and cattle development of a trick after everyone can also use up ~ ~ ~
Postscript:
Test attention to a lot of things, point to face, and then surface to the points, and developers in the technical understanding will be a lot of analysis methods, we found that the bug is not directly lost to development, fix after the peripheral regression, but to develop consulting analysis method, get "fishing", development is also very happy to teach us, In this way we will have a similar problem in the future can be directly analyzed, so as to constantly improve themselves, improve efficiency, and will have a sense of accomplishment, this is a very happy thing.
from:http://testing.etao.com/node/615
Linux Jstack Analysis CPU consumption 100%