首页  

利用shell命令分析java线程堆栈     所属分类 shell 浏览量 1410
找出java进程id
ps aux|grep xxxxxx

使用jstack命令打印线程堆栈信息

jstack 7363

java线程数统计 
jstack 7363|grep java.lang.Thread.State: -c
 
线程各种状态统计
jstack 7363|grep java.lang.Thread.State: |sort|uniq -c

     34    java.lang.Thread.State: RUNNABLE
      3    java.lang.Thread.State: TIMED_WAITING (on object monitor)
      8    java.lang.Thread.State: TIMED_WAITING (parking)
      9    java.lang.Thread.State: TIMED_WAITING (sleeping)
      2    java.lang.Thread.State: WAITING (on object monitor)
     73    java.lang.Thread.State: WAITING (parking)

第一列作为数字降序排序

jstack 7363|grep java.lang.Thread.State: |sort|uniq -c|sort -rn -k 1


     75    java.lang.Thread.State: WAITING (parking)
     34    java.lang.Thread.State: RUNNABLE
      9    java.lang.Thread.State: TIMED_WAITING (sleeping)
      8    java.lang.Thread.State: TIMED_WAITING (parking)
      3    java.lang.Thread.State: TIMED_WAITING (on object monitor)
      2    java.lang.Thread.State: WAITING (on object monitor)

上一篇     下一篇
Autowired和Resource注解的区别

springIOC容器相关注解

springboot简单例子

软件架构设计几大原则

网页上显示html和xml代码的几种方法

linux手工释放cache