This tutorial explains how to profile a Java Applet running in a web browser with JavaSoft's Java Plug-In 1.1 or 1.2.
In order to profile with the Java Plug-In 1.3, please refer to the tutorial Profiling an applet running in a browser with JavaSoft's Java Plug-In 1.3.

To perform this operation, the following components are required:

Follow the instructions below to start the profiler in your web browser.

Note: if you are using JDK 1.2, make sure to install /reinstall OptimizeIt in a directory which path does not contain any space (' '). This is necessary because the Java plugin control panel does not support spaces in the Java Run Time Parameters field.

1) Using the Java Plug-In

Note: make sure not to add extra spaces between the different parameters specified in the Java Run Time Parameters. It could cause the plugin to ignore some parameters and OptimizeIt would not run correctly. In order to start your applet with the Java Plug-In, you need to change your HTML file to use the <OBJECT> tag or the <EMBED> tag. The Java Plug-In HTML specification explains how to do this. JavaSoft also provides a tool to convert html files to use the Java Plug-In.

2) Configuring your computer

To profile an applet in your web browser, you need to modify the system CLASSPATH to add OptimizeIt classes and modify the system PATH to add OptimizeIt native code. Here is how to do this:
  1. Opening the environment settings
  2. Changing the PATH environment variable to include OptimizeIt native code.
  3. Changing the CLASSPATH environment variable to include OptimizeIt classes.
After changing PATH and CLASSPATH, you need to restart your web browser.

3) Starting OptimizeIt audit system

The following applet starts OptimizeIt audit system. Once OptimizeIt's audit system is running you can attach with OptimizeIt and profile all applets running in your web browser.

If the applet below does not start or is invisible, make sure that:

Click on the the Start audit system button below to start OptimizeIt's audit system.
</COMMENT>No JDK 1.1 support for APPLET!!&nbsp;
  • Change the port number if the default port number is already used on your machine. 
  • Disable the memory profiler if you only want to focus on CPU/Time usage. 
  • Enable audit API, if you want to profile a subset of your application and your code calls enableCPUProfiler() or/and enableMemoryProfiler()

Important notes:

4) Attaching from OptimizeIt

After attaching, OptimizeIt displays performance data for all applets running in the web browser with the Java Plug-In. Use the web browser to start your applet and begin the profiling session.

Each time you restart the web browser, you need to come back to this page to start the profiler.

5) Starting OptimizeIt profiler from your Java code

While the applet on this page is convenient to start profiling quickly, you may want to automatically start OptimizeIt's profiler with your applet. That way, you don't have to go to this page to start the profiler before starting your applet.

Starting OptimizeIt profiler can be easily done by using OptimizeIt's API. OptimizeIt's API is documented in OptimizeIt user manual, chapter 9. The following code demonstrates how to start the profiler from your applet's init method.

import intuitive.audit.Audit;
...
...
public void init() {
...
 /* Start OptimizeIt's profiler */
 Audit.start(1470, Audit.PROFILERS_ALWAYS_ENABLED);
...
}

Once OptimizeIt's profiler is running, you can attach to the virtual machine from OptimizeIt.

Copyright (c) 1997, 1998, 1999, 2000 Intuitive Systems Inc. All rights reserved. Specifications subject to change without notice.
OptimizeIt is a trademark of Intuitive Systems, Inc.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. All other brand names and products are trademarks or registered trademarks of their respective holders.