Java虚拟机的统计监测工具:jstat

16 篇文章 0 订阅
16 篇文章 0 订阅

 

jstat:是JDK自带的虚拟机统计监测工具
在命令行中执行jstat

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可以查看JVM当前的各种信息,比如:类, 内存等
参数主要有:

  • class: 类装载器统计
  • compiler: HotSpot JVM实时编译统计
  • gc: 垃圾回收堆统计
  • gccapacity: 内存统计
  • gccause: 垃圾回收统计信息,包括回收事件
  • gcnew: 对象创建情况
  • gcnewcapacity: 对象创建内存情况
  • gcold: 老年代和永久代统计
  • gcoldcapacity: 老年代统计
  • gcpermcapacity: 永久代统计
  • gcutil: 垃圾收集的统计
  • printcompilation: HotSpot编译器的方法统计

执行: jstat -class 2000 结果如下

加载类的个数加载类的大小卸载类的个数卸载类的大小加载和卸载所占用的时间
LoadedBytesUnloadedBytesTime
2362429798.813461225.8218.34

执行: jstat -compiler 2000 结果如下

编译的个数编译失败的个数无效的编译个数编译所用时间最后一次编译失败的类型最后一次编译失败的方法
CompiledFailedInvalidTimeFailedTypeFailedMethod
1629100.861org/springframework/asm/ClassReader accept

执行: jstat -gc 2000 结果如下

Survivor 0的大小(KB)Survivor 1的大小(KB)Survivor 0使用大小Survivor 1使用大小Eden大小Eden使用大小Old大小Old使用大小Permanent大小

Permanent

使用大小

Young generation GC次数Young generation GC时间Full GC次数Full GC时间所有GC时间
S0CS1CS0US1UECEUOCOUPCPUYGCYGCTFGCFGCTGCT
14016.014016.02932.50.0112192.096465.9280212.0227679.0116480.0116338.641837.8233459.92897.751

执行: jstat -gccapacity 2000 结果如下

新生代最小新生代最大当前新生代(NGC=S0C+S1C+EC)Survivor 0大小Survivor 1大小Eden大小老年代最小老年代最大老年代当前大小老年代当前容量永久代最小永久代最大当前永久代大小永久代容量Young GC次数Full GC次数
NGCMNNGCMXNGCS0CS1CECOGCMNOGCMXOGCOCPGCMNPGCMXPGCPCYGCFGC
13632.0174720.0140224.014016.014016.0112192.027328.0349568.0280212.0280212.012288.0262144.0116480.0116480.041934

执行: jstat -gccause 2000 结果如下

Survivor 0使用率Survivor 1使用率Eden使用率Old使用率Permanent使用率YoungGC次数YoungGC时间FullGC次数FullGC时间GC总时间上一次GC原因当前GC原因
S0S1EOPYGCYGCTFGCFGCTGCTLGCCGCC
0.0021.8520.6881.2599.8841937.8363459.92897.764unknown GCCauseNo GC

执行: jstat -printcompilation 2000 结果如下

编译次数方法的字节码的字节数编译类型编译方法
CompiledSizeTypeMethod
13575171org/eclipse/swt/widgets/Caret hasFocus
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值