码迷,mamicode.com
首页 > 编程语言 > 详细

shell分析线程堆栈

时间:2020-03-13 01:38:52      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:状态   stack   monitor   grep   waiting   park   xxxxxx   object   使用   

找出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)

shell分析线程堆栈

标签:状态   stack   monitor   grep   waiting   park   xxxxxx   object   使用   

原文地址:https://www.cnblogs.com/daomeidan/p/12483999.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!