This tutorial explains how to profile Java code with
ATG Dynamo 4.5.0 and 5.1.
In this document:
-
<OptItDir> is the directory where OptimizeIt has been installed.
(ex: c:\OptimizeItDemo\OptimizeIt40D)
-
<DynamoDir> is the directory where Dynamo has been installed
(ex: c:\ATG\Dynamo5.1)
-
<DynamoLocalConfigDir> is the the localconfig directory of
your Dynamo installation (ex: with Dynamo 4.5.0 c:\ATG\Dynamo4.5.0\localcongif
with
Dynamo 5.1 c:\ATG\Dynamo5.1\home\localconfig).
1) Adding the OptimizeIt servlet to Dynamo
First you need to add the OptimizeIt servlet to your
Dynamo server.
-
Create a directory optimizeit under your
<DynamoLocalConfigDir>\atg\dynamo
-
Create the file <DynamoLocalConfigDir>\atg\dynamo\optimizeit\OptimizeItServlet.properties
-
In that file, just put the line:
-
Edit the file <DynamoLocalConfigDir>\atg\dynamo\Configuration.properties
and
add at the end of the file the following line:
dispatcherServiceMap+=/OptimizeIt.dyn=optimizeit/OptimizeItServlet
-
Copy the file <OptItDir>\lib\servlet\OptimizeIt.class
to
<DynamoDir>\home\locallib (with Dynamo 5.1) or to <DynamoDir>\home\locallib
(with
Dynamo 4.5).
2) Configuring the batch file dynamo_OptIt.bat
-
Copy the file dynamo_OptIt.bat located in the <OptItDir>\Tutorial\script
to the <DynamoDir>\home\bin directory if you are running Dynamo
5.1 or <DynamoDir>\bin directory if you are running Dynamo
4.5.
-
Edit the dynamo_OptIt.bat you have just copied
-
Enter the path to your OptimizeIt directory after the statement:
set OPTITDIR=
Example: set OPTITDIR=c:\OptimizeItDemo\OptimizeIt40D
-
Enter the home directory of your Java virtual machine you want to use after
the statement:
set JAVAHOME=
Example: set JAVAHOME=c:\jdk1.2.2
Note that if you are running Dynamo 5.1, you can leave this field empty:
the default JRE 1.2.2 included with Dynamo will be used.
-
(Optional) Change the line:
set USEHOTSPOT=false
to
set USEHOTSPOT=true
if you use the JDK 1.3.1 and you want to use the Hotspot runtime.
3) Starting Dynamo for profiling with OptimizeIt
To start Dynamo, just invoke the dynamo_OptIt.bat
script.
4) Starting the OptimizeIt servlet
Invoke the servlet from a web browser. The URL should
look like http://localhost/OptimizeIt.dyn
In the HTML page that the servlet provides, change
the port number if necessary.
Select the "Disable memory profiler" option if you
only want to focus on CPU usage.
Select "Enable OptimizeIt's audit system API" if
your code enables/disables the profiler by using OptimizeIt's audit system
API
Press the "Start OptimizeIt Audit System" button
to start the profiler.
Once this operation is done, you should see a message
in your web browser indicating that OptimizeIt's audit system is running.
5) Attaching from OptimizeIt
Now that Dynamo 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, Dynamo exits. After
doing this, you need to restart Dynamo server.
6) Filtering resources used by Dynamo
OptimizeIt provides filters for filtering resources used by Dynamo. In
order to use filters, you must create an OptimizeIt setting for the profiling
session, turn on the Dynamo filter, and then attach by using the
Attach now button or pressing the play button.
-
Start Dynamo using the dynamo_OptIt.bat
script.
-
Access the OptimizeIt servlet and start the audit system into Dynamo
-
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 ATG Dynamo.
-
If you want to ignore CPU or time consumed by Dynamo, check the Ignore
CPU usage column on that line.
-
If you want to ignore object allocations performed by Dynamo, 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, 2001 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.