2

【笔记】Java程序线程运行诊断

 1 year ago
source link: https://loli.fj.cn/2023/01/25/Java%E7%A8%8B%E5%BA%8F%E7%BA%BF%E7%A8%8B%E8%BF%90%E8%A1%8C%E8%AF%8A%E6%96%AD/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】Java程序线程运行诊断

2023-01-252023-01-26

在Linux下进行Java程序的线程运行诊断

查看进程运行状况

top

查看进程的所有线程

  • 通过进程id查看对应的所有线程

-eo:只查看指定字段的数据
<pid>:指定进程id

ps H -eo pid,tid,%cpu | grep <pid>

查看线程运行状态

  • 通过JDK工具,查看线程的运行状态,从而定位代码位置

<pid>:指定进程id

jstack <pid>
  • 通过上一步得到的线程id(十进制),转换为十六进制数,就可以快速定位产生问题的线程所在的代码行数

哔哩哔哩——黑马程序员


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK