JDK 1.5 HEAP MONITOR Web Age Solutions Inc. INTRODUCTION As a general rule of thumb, a Java application should not spend more than 10% of the time performing GC. The -verbosgc output of Sun JDK does not show the interval between GCs or keep statistical average of the time spent in doing GC. That is where this JVMTI monitor comes into play. It is a high performance monitor that shows GC statistics in a simple to understand screen. DOWNLOAD AND INSTALLATION The monitor is developed using the JVMTI API. It requires Java 1.5. It has been tested in Sun JDK 1.5 for Windows. Download the DLL from here. Copy the DLL in any folder that is in your PATH. For example, C:\WINNT. HOW TO USE THE MONITOR To load the monitor, add the “-agentlib:hm” command line option to Java. For example: java -agentlib:hm com.webage.Test The statistics window will show up immediately. It shows the following information. Samples: The number of GCs used in the average calculations. Avg duration: Average amount of time spent in GC in seconds. A small number is better. Avg interval: Average interval between two GCs in seconds. A large number is better. Percentage: Percetage of time spent in GC. It is calculated as (Avg duration x 100) / (Avg duration + Avg interval). This number should be well below 10%. Last duration: Duration of the last GC. Last interval: Interval between the last two GCs. Click on the Reset button to clear the statistics. Usually, you should reset the statistics before every stress test run. DEFECTS The duration numbers are a few nanoseconds more than what -verbosegc shows. This is possibly due to the JVMTI overhead. This difference is negligible. This tool uses low level code and a defect can bring down the JVM. Test it thoroughly before deciding to use it in production. Please report any defect using the feedback form below. LICENSING You are free to use this tool in any circumstances. There is no warranty of any kind. Web Age is not responsible for any damage of loss caused by this tool.