Wednesday, March 21, 2012

Finding java thread which takes highest CPU

1 .Get the process id of java process

ps -aefww

2. Get all threads and CPU it consumes

ps -eLo pid,lwp,nlwp,ruser,pcpu,stime,etime,args|grep PROCESS ID

Convert llwp from decimal to hex (so 8245 would be 2035)

3. Take thread dump of java process

now open the thread dump with text editor and search for 2035, you will find something similar:
"TP-Processor234786" daemon prio=10 tid=0x00002aaad8024800 nid=0x2035 runnable [0x00002aaadef29000]
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(HashMap.java:303)
at ......


Ref :http://javadrama.blogspot.co.uk/2012/02/why-is-java-eating-my-cpu.html

 
Free Domain Names @ .co.nr!