美文网首页
查看进程下线程数

查看进程下线程数

作者: 尝试热爱这个世界 | 来源:发表于2021-06-24 10:43 被阅读0次

查看线程数的总量

1.ps -o nlwp PID

2.cat /proc/PID/status |grep -i thread

3.ll /proc/PID/task |wc -l     (算出来数量减1,当前所在文件夹也会算进去)

nlwp含义是number of light-weight process。

ps  -o nlwp 27989

获得真正在running的线程数量

ps -eLo pid ,stat | grep 27989 | grep running | wc -l

Sl表示大多数线程都处于空闲状态

统计应用线程数 jstack 2702 | grep java.lang.Thread.State | awk '{print $2}' | sort | uniq -c

相关文章

网友评论

      本文标题:查看进程下线程数

      本文链接:https://www.haomeiwen.com/subject/xrswyltx.html