Welcome to the OptimizeIt Java profiler. This tutorial guides you through the basic features of OptimizeIt software. More information is available in the OptimizeIt User Manual, an HTML document included in the OptimizeIt package. If you have any questions not answered in the documentation, please contact us at support@intuisys.com. |
This tutorial assumes that OptimizeIt has been installed and is properly configured with the Java virtual machine.
For information about installing and configuring OptimizeIt, see Configuring
OptimizeIt. This tutorial also assumes that Java Developer's Kit (JDK) version 1.1.7 has been installed at its default location (c:\jdk1.1.7). If you installed the JDK somewhere else, make sure to point to the installed location when instructed to in the tutorial. |
To profile a Java program, OptimizeIt launches your Java program and the OptimizeIt audit system. The audit system runs in the test virtual machine and reports profiling information to OptimizeIt. The following steps show how to launch a simple applet for profiling. To launch an applet
|
When you first launch a test program, the OptimizeIt window opens to the memory profiler. The window can also display the CPU profiler, as the tutorial describes later. The memory profiler lists the classes included in the test program and the real-time count of the number of instances allocated for each class. This is Heap mode. It allows you to see object allocations as they occur. The following steps show how to use the controls in the memory profiler to analyse how the example applet uses memory. To use the memory profiler
Using the memory profiler allows you to minimize temporary object allocations. Temporary objects are usually quick to allocate, however they keep the garbage collector busy. With most available Java virtual machines, any Java program may freeze for several hundred milliseconds when the garbage collector is busy. If too many temporary objects are allocated, the application can feel really slow to the user because of these interruptions. The OptimizeIt Professional Edition memory profiler also allows you to understand why an object is not freed by the garbage collector. For example, this can be useful to verify that a document storage is really garbage collected when a document is closed. The following steps describe using the memory profiler to determine whether an instance is being or can be garbage collected. To display information about a specific instance
OptimizeIt displays the string representation of the instance in the top section of the window. The middle section displays which objects reference the selected instance and recursively which objects reference the object that references the instance. In this case, because the MenuItem object is referenced, it cannot be garbage collected. The bottom section displays the allocation backtrace for the instance selected in the middle section. In this case, note that many of these MenuItems were allocated during the initialization of the AppletViewer method. These are the menu items for the menu "Applet" in the example program. |
While the memory profiler allows you to understand how to minimize object allocations, the CPU profiler allows you to understand how time is spent by objects. The CPU profiler can be seen as a recording device inside the Java virtual machine. The following steps describe how to produce time and CPU-usage information for your test program. To use the CPU profiler
To analyse where a thread sits idle, the CPU profiler can display pure CPU use and time use at the same time. Use this feature to choose a caching strategy, for example. By default OptimizeIt displays pure CPU use information. To display elapsed time and CPU usage together
For more information about OptimizeIt, see the OptimizeIt User Manual. |