This tutorial explains how to profile Java code
with Jakarta Tomcat, configured as a stand-alone servlet container, or
configured as an add-on to Apache web server.
In this document, <OptItDir>
is the directory where OptimizeIt has been installed. (ex: c:\OptimizeIt\OptimizeIt40D),
and <TomcatDir> is the directory where Tomcat has been installed
(ex: c:\jakarta-tomcat).
1) Configuring the tomcatWithOptimizeIt script
-
Copy the file tomcatWithOptimizeIt.bat
located in the <OptItDir>\Tutorial\script to the <TomcatDir>\bin
directory.
-
Edit the new copied file <TomcatDir>\bin\tomcatWithOptimizeIt.bat
-
Enter the directory of your virtual machine after the statement:
Example: set JAVAHOME=c:\jdk1.3
-
Enter the path to your Tomcat directory after the
statement:
Example: set TOMCATDIR=c:\jakarta-tomcat
-
Enter the path to your OptimizeIt directory after
the statement:
Example: set OPTITDIR=c:\OptimizeIt\OptimizeIt40D
-
(Optional) Change the port number if necessary by modifying the line:
-
(Optional) Uncomment the line:
if you only want to focus on CPU usage.
-
(Optional) Uncomment the line:
rem set OPTIONS="-enableAPI $OPTIONS"
if your code enables/disables the profiler by
using OptimizeIt's audit system API.
-
(Optional) Add any extra CLASSPATH at the line:
-
(Optional) Add any extra java parameters at the line:
2) Starting Tomcat
-
If you have configured Tomcat to run with Apache
server, start Apache.
-
Start Tomcat by invoking the tomcatWithOptimizeIt.bat
script:
3) Attaching from OptimizeIt
Now that Tomcat is running with OptimizeIt profiler, you can start OptimizeIt
and attach to the virtual machine.
-
Start OptimizeIt from the Start menu.
-
Close the Edit Settings panel by pressing the OK button.
-
From the Program menu, select Attach.
-
Change the port number and the hostname if necessary.
-
Press the Attach button.
Note: OptimizeIt does not have a "detach" function. If you press
the stop button in OptimizeIt, Tomcat exits. After doing this, you need
to restart Tomcat.
4) Filtering resources used by Tomcat
OptimizeIt provides filters for filtering resources used by Tomcat. In
order to use filters, you must create an OptimizeIt setting for the profiling
session, turn on the Tomcat filter, and then attach by using the
Attach now button or pressing the play button.
-
Start Tomcat using the tomcatWithOptimizeIt.bat
script.
-
Start OptimizeIt from the Start menu.
-
Close the settings editor by pressing OK.
-
From the File menu, select New
-
In the Edit Settings panel select Remote
Application in the Program type part.
-
Change the hostname or the port number if necessary.
-
Switch to the Filters section by clicking the
Filters
tab.
-
In the table, find the line with the name Jakarta
Tomcat.
-
If you want to ignore CPU or time consumed by
Tomcat, check the Ignore CPU usage column on that line.
-
If you want to ignore object allocations performed
by Tomcat, check the Ignore Memory usage column on that line.
-
Press the Attach now button.
Note: OptimizeIt settings can be saved for subsequent usage. This
is done by using the save menu.
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.