Jstat名称:Java Virtual Machine statistics monitoring tool
官方文档:https://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html
功能描述:
Jstat是JDK自带的一个轻量级小工具。它位于java的bin目录下,主要利用JVM内建的指令对Java应用程序的资源和性能进行实时的命令行的监控,包括了对Heap size和垃圾回收状况的监控。
命令用法:jstat [-命令选项] [vmid] [间隔时间/毫秒] [查询次数]
注意:使用的jdk版本是jdk8。
C:\Users\Administrator>jstat -help
Usage: jstat -help|-options
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
Definitions:
<option> An option reported by the -options option
<vmid> Virtual Machine Identifier. A vmid takes the following form:
<lvmid>[@<hostname>[:<port>]]
Where <lvmid> is the local vm identifier for the target
Java virtual machine, typically a process id; <hostname> is
the name of the host running the target Java virtual machine;
and <port> is the port number for the rmiregistry on the
target host. See the jvmstat documentation for a more complete
description of the Virtual Machine Identifier.
<lines> Number of samples between header lines.
<interval> Sampling interval. The following forms are allowed:
<n>["ms"|"s"]
Where <n> is an integer and the suffix specifies the units as
milliseconds("ms") or seconds("s"). The default units are "ms".
<count> Number of samples to take before terminating.
-J<flag> Pass <flag> directly to the runtime system.
- option:参数选项
- -t:可以在打印的列加上Timestamp列,用于显示系统运行的时间
- -h:可以在周期性数据输出的时候,指定输出多少行以后输出一次表头
- vmid:Virtual Machine ID( 进程的 pid)
- interval:执行每次的间隔时间,单位为毫秒
- count:用于指定输出多少次记录,缺省则会一直打印
option 可以从下面参数中选择
C:\Users\Administrator>jstat -options -class -compiler -gc -gccapacity -gccause -gcmetacapacity -gcnew -gcnewcapacity -gcold -gcoldcapacity -gcutil -printcompilation