A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)

jvmstat 3.0 can monitor J2SE 5.0, J2SE 1.4.2 and J2SE 1.4.1 virtual machines,
jvmstat3.0 need JDK5.0 installed, for those cannot upgrade to JDK5.0,pls find the previous version in:
1.1:
Reference[3]
2.0:
Reference [4]
Actually you can find them in the jvmstat FAQ point 11.

[b]1: Install and setup[/b]
For installation and setup problem pls refer to reference[1], the installation part.

[b]2: Simple test[/b]
[b]a) Test in local[/b]
For local test, here choose the Java2DDemo to demonstrate the usage of jps/jstat/visualgc

After the installation finished,
<1>Start the Java2DDemo swing java application
[color=green]C:\>java -jar "C:\Program Files\Java\jdk1.5.0_06\demo\jfc\Java2D\Java2Demo.jar[/color]
<2> use jps to find the PID of the Java2DDemo, or you can find the PID in windows task manager.
[color=green]C:\>jps
5964 Program
5596 Jps[/color]
there is always has the Jps process. here the 5964 is PID of the Java2DMemo java application
<3> get the GC status by jstat and pipeline to a file to PID 5964, with 1000ms intervals and 1000 times.
[color=green]C:\>jstat -gcutil 5964 1000 1000 >> c:\gc.log[/color]
for the usage of jstat you can get help by [color=blue]jstat -help[/color] and [color=blue]jstat -options[/color]

<4> Visual monitor the GC with visualgc
[color=green]C:\>visualgc 5964[/color]
You will see the UI ref <VisualGC PID output> below.

[b]b) Test for remote[/b]


[b]3: Problems[/b]
For any problems you can refers to [2] FAQ. Actually most of the problems can find the workaround there.

References:
[1][url]http://java.sun.com/performance/jvmstat[/url]
[2][url]http://java.sun.com/performance/jvmstat/faq.html[/url]
[3][url]https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=JVMSTAT-1.0-G-F@CDS-CDS_Developer[/url]
[4][url]https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=JVMSTAT-2.0-G-F@CDS-CDS_Developer[/url]
[5][url]http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf[/url]

VisualGC PID output:
[img]http://dl.iteye.com/upload/attachment/254102/565ce03e-b106-3ee9-a85e-6443d595e9ad.gif[/img]

jstat -gcutil 5964 1000 10 output:
[img]http://dl.iteye.com/upload/attachment/254111/750ff914-e3ce-3c3e-91e0-f24ee4bc1ae7.gif[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值