今天给推荐一个工具useful-scriptsjava
github地址 https://github.com/jiankunking/useful-scriptsgit
这个工具能快速的帮咱们定位到致使CPU异常的代码。github
1安装工具
wget --no-check-certificate https://github.com/oldratlee/useful-scripts/archive/release-2.x.zip
unzip release-2.x.zip
2使用
cd useful-scripts-release-2.x/bin
./show-busy-java-threads -p 进程号
如 ./show-busy-java-threads -p 15030 能够看到15030进程当前进程占用CPU最高的5条线程
3.使用命令