今天給推薦一個工具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.使用命令