* 使用top查看进程CPU使用率,获取进程的pid
top
* 查看线程的CPU使用率,获取线程pid
top -Hp pid
* 线程PID亿16进制打印
printf '%x' pid
* 使用jstack 进程ID 将堆栈信息放入文件中
jstack pid > xxx.txt
* 《1》打开文件xxx.txt,搜索进程id
执行到这里可能会报错:报错如下
Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
有人说是执行这个命令的用户和服务启动的用户不匹配,切换到对应用户下执行命令可解决
vim xxx.txt
/16进制线程号
* 《1》或者使用grep进行搜索,查看信息
cat xxx.txt | grep 16进制线程号
或者
grep 16进制线程号 xxx.txt
网友评论