Home > Java > javaTutorial > body text

Share an example of outputting jstack information of a java process. Analyze java threads through thread stack information.

高洛峰
Release: 2017-01-19 11:09:56
Original
2485 people have browsed it

#!/bin/sh
pro_name=java #process name
keys=`ps -ef |grep "$pro_name" |grep -v "grep" | awk '{print $2}'`
nowdate=`date +%Y%m%d%H%M%S`
jstackpath="/usr/java/jdk1.6.0_07/bin/jstack"
cpulogpath="/home/"
for key in ${keys}
do
  cpulogpath_file="${cpulogpath}cpu_${nowdate}${key}.log"
  cpustackCmd="${jstackpath} -l ${key} >${cpulogpath_file}"
  echo "command: ${cpustackCmd}"
  eval $cpustackCmd
done
Copy after login


更多输出java进程的jstack信息示例分享 通过线程堆栈信息分析java线程相关文章请关注PHP中文网!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template