java分析工具
jinfo:命令可以用来查看 Java 进程运行的 JVM 参数
jstat:(Java Virtual Machine statistics monitoring tool)虚拟机统计监控工具
jmap:JVM Memory Map命令用于生成heap dump文件
jstack:jstack是jvm虚拟机自带的一种堆栈分析工具,用于打印出给定的java进程或者core file或者远程调试服务的堆栈信息等
(1)、jinfo: 命令可以用来查看 Java 进程运行的 JVM 参数
Name
jinfo - Configuration Info
SYNOPSIS
jinfo [ option ] pid
jinfo [ option ] executable core
jinfo [ option ] [server-id@]remote-hostname-or-IP
PARAMETERS
option
Options are mutually exclusive. Option, if used, should follow
immediately after the command name.
pid
process id for which the configuration info is to be printed. The
process must be a Java process. To get a list of Java processes
running on a machine, jps(1) may be used.
executable
Java executable from which the core dump was produced.
core
core file for which the configuration info is to be printed.
remote-hostname-or-IP
remote debug server’s (see jsadebugd(1)) hostname or IP address.
server-id
optional unique id, if multiple debug servers are running on the
same remote host.
DESCRIPTION
jinfo prints Java configuration information for a given Java process or
core file or a remote debug server. Configuration information includes
Java System properties and Java virtual machine command line flags. If
the given process is running on a 64-bit VM, you may need to specify
the -J-d64 option, e.g.:
jinfo -J-d64 -sysprops pid
NOTE - This utility is unsupported and may or may not be available in
future versions of the JDK. In Windows Systems where dbgeng.dll is not
present, ’Debugging Tools For Windows’ need to be installed to have
these tools working. Also, PATH environment variable should contain the
location of jvm.dll used by the target process or the location from
which the Crash Dump file was produced.
For example, set PATH=<jdk>\jre\bin\client;%PATH%
OPTIONS
<no option>
prints both command line flags as well as System properties name,
value pairs.
-flag name
prints the name and value of the given command line flag.
-flag [+|-]name
enables or disables the given boolean command line flag.
-flag name=value
sets the given command line flag to the specified value.
-flags
prints command line flags passed to the JVM. pairs.
-sysprops
prints Java System properties as name, value pairs.
-h prints a help message
-help
prints a help message
查看java进程的扩展参数
-flag <name> 查看某个jvm参数
-flag +/- <name> 动态开启或关闭部分jvm参数
-flag name=value 修改部分jvm参数
flags 查看所有jvm参数
-sysprops 查看系统参数(System.getProperties())
(2)、jstat:(Java Virtual Machine statistics monitoring tool)虚拟机统计监控工具
jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]
option: 参数选项
-t: 可以在打印的列加上Timestamp列,用于显示系统运行的时间
-h: 可以在周期性数据数据的时候,可以在指定输出多少行以后输出一次表头
vmid: Virtual Machine ID( 进程的 pid)
interval: 执行每次的间隔时间,单位为毫秒
count: 用于指定输出多少次记录,缺省则会一直打印
(3)、jmap:JVM Memory Map命令用于生成heap dump文件
jmap [ option ] pid
jmap [ option ] executable core
jmap [ option ] [server-id@]remote-hostname-or-IP
option: 参数选项
eap:显示Java堆详细信息;
histo:线下堆中对象的统计信息;
clstats:Java堆中内存的类加载器的统计信息;
finalizerinfo:显示在F-Queue队列等待Finlizer线程执行finalizer方法的对象;
dump:生成堆转储快照;
F:当-dump没有响应时,强制生成dump快照;
(4)、jstack:jstack是jvm虚拟机自带的一种堆栈分析工具,用于打印出给定的java进程或者core file或者远程调试服务的堆栈信息等
SYNOPSIS
jstack [ option ] pid
jstack [ option ] executable core
jstack [ option ] [server-id@]remote-hostname-or-IP
option: 参数选项
-F 执行线程转储
-m 打印java和本地帧
-l打印列表信息,包括锁相关的信息
网友评论