Java内存分析工具——Jstat

来源:互联网 发布:网络知识培训手机 编辑:程序博客网 时间:2024/04/30 14:00

Jstat工具位于$JAVA_HOME/lib文件下,主要用于查看堆内各个部分的使用量,以及类的数量。
1,Jstat的主要参数:
-1,jstat -class pid:显示加载的class的数量,以及所占空间等信息。

➜  ~  jstat -class 52936
Loaded  Bytes  Unloaded  Bytes     Time
 11593 23641.9        0     0.0      14.16

-2,jstat -compiler pid:显示VM实时编译的数量等信息。

➜  ~  jstat -compiler 52936
Compiled Failed Invalid   Time   FailedType FailedMethod
    1975      1       0    27.60          1 org/apache/tomcat/util/IntrospectionUtils setProperty

-3,jstat -gc pid:可以显示gc的信息,查看gc次数以及时间。

➜  ~  jstat -gc 52936
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT
64512.0 51200.0  0.0   51188.5 831488.0 515836.9  174592.0   81231.8   71168.0 70970.5     11    0.314   0      0.000    0.314
➜  ~

其中的几项参数意义如下:
S0C:Current survivor space 0 capacity(KB)
S1C:Current survivor space 1 capacity(KB)
S0U:Current space 0 utilization(KB)
S1U:Survivor space 1 utilization(KB)
EC:Current eden space capacity()
EU:Eden space utilization
OC:Old space capacity.Old space空间。
OU:Old space utilization。Old space已用空间比
PC:Current permanent sapce capacity
PU:Permanent space utilization
YGC:Young generation garbage collection Events。Young区,GC次数。
YGCT:young genaration GC tiome. Young区,gc回收时间
FGC:Number of full GC events.Full GC次数。
FGCT:FGC Time。
GCT:Total GC time。
-4,jstat -gccapacity pid:可以显示VM中内存(young, old, perm)对象的使用和占用大小。

~  jstat -gccapacity 52936
 NGCMN    NGCMX     NGC     S0C      S1C       EC        OGCMN     OGCMX       OGC         OC       PGCMN    PGCMX     PGC       PC     YGC    FGC
 87552.0 1398272.0 1398272.0 64512.0 51200.0 831488.0   174592.0  2796032.0   174592.0   174592.0  21504.0  83968.0  71168.0  71168.0     11     0

-5,jstat -util pid:统计GC的信息。
以上就是比较常用的一些查看当前GC的常用命令。

主要参考:

http://www.cnblogs.com/mazj611/p/3481610.html

http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html

0 0
原创粉丝点击