Launching or attaching a Java process
To profile a process, it needs to be running, an agent needs to be
associated with it, and you need to attach to that agent. If the
process is already running, you only need to attach to its agent.
Attach means that a monitor is created to contain the results
observed by an associated agent.
If the process is not running, then you need to launch it. Launch
means that the process is started, an agent is associated with the
process, and a monitor is created to contain the results observed by
the agent.
Whenever you launch or attach to a Java process, a logical representation
of the Java process is created in the Profiling Monitor view. This
representation, the process object, is identified both by name and
an ID number (PID) that appears in the view along with the associated
agents.
Note. The iSeries JVM requires the following options
to generate method entry and exit events for method statistics:
-Dos400.enbprfcol=1 -Djava.compiler=jitc
To either launch or attach either a local or a remote Java process,
follow these steps:
- From the Profiling and Logging Perspective, click on the Profile drop-down button, and select
Profile...:

- If you want to attach to a Java process...
- Double click on Attach - Java Process.
- On the Host tab, specify the Host name or IP address and the
Agent Controller port (if different from the default). Click Add,
then switch to the Agents tab.
- The Agents tab displays available agents that are running and collecting data.
Select the agents that are associated with the process ID you want to attach to and move then to
the right side pane. Click Refresh at any time to get the most up-to-date list
of agents.
- If you want to launch a Java process within the workspace...
- Double click on Java Application.
- Select the Java Project and Main class that you intend to
profile.
- In the Arguments tab, enter any Program arguments and/or
VM arguments that you want this configuration to use.
- If you want to launch an external Java process...
- Double click on External Java Application.
- On the Host tab, specify the Host name or IP address and
the Agent Controller port (if different from the default). Click
Add, then switch to the Main tab.
- Select the Java Class on the file system.
- You may need to specify where to find the Class path, directory,
and JAR file.
- You may specify Parameters, VM arguments, and Environment
Variables, as needed.
- If you want to launch an Eclipse runtime workbench...
- Double click on Run-time Workbench.
- On the Arguments tab, change the arguments that are used to launch the runtime
workbench, or accept the defaults and select the Plug-ins tab.
- The Plug-ins tab provides the opportunity to select the plug-ins that will be
loaded on start-up on the runtime workbench. Make all necessary changes (or accept the defaults),
and click on the Tracing tab.
- On the Tracing tab, you may modify tracing flags used by plug-ins.
- Click on the Profiling tab. This tab allows you to specify
the parameters used by the profiling tool when collecting information.
- The Profiling > Overview tab allows you to control the type of
information in the profiling tool. By default, three sample profiling sets
are provided, each of which instructs the profiling tool to collect different
types of information:
- Memory Analysis collects application heap information.
- Execution History provides profiling information relating to
an application's execution time.
- Method Coverage Information retrieves information concerning
the methods that were executed.
You may customize the list of profiling sets available by creating
(Add...), renaming (Rename...), and/or
deleting (Remove) entries. You can also modify the type
of information collected by a profiling set by selecting the profiling set
that you want to modify, and clicking on the Edit... button:

In the Edit Profiling Set dialog, check or uncheck the type of information
that should be collected by the profiling set. In the screenshot above, the profiling
set is configured to perform Memory/Leak Anlysis.
- If you are interested in memory related profiling, such as heap analysis
and memory statistics, check and select Memory/Leak Analysis.
- On the right hand side of the dialog, select Show instance
level information. By selecting this option, instance details
are provided. This option can increase the amount of data collected by
the profiling session and, in turn, can slow down your application.
- To analyze application execution, check and select Execution Time Analysis.
- On the right hand side of the dialog, select Show execution
flow graphical details to analyze the application execution using
the Execution Flow view. This option also increases the amount of
data collected by the profiling session and, in turn, can slow down your
application.
- Choose Method Coverage Information to view method execution
information.
If you chose Memory/Leak Analysis and/or Execution Time
Analysis, you can also control the data collected based on Class and
package by clicking Next. For more details, see
Specifying Profiling Filters.
- You may specify whether profiling should stop after some number of
method invocations or some amount of time in the
Profiling > Limits tab.
- On the Profiling > Destination tab, specify the project and monitor
in which to store data from this profiling session. You could also specify an
external file.
- Click Apply, then Run to start profiling.

Some notes:
- The Profiling Console opens, displaying program input and output.
- The associated agents monitor the application (shown with the Monitoring symbol
)
until it has run to completion.
- Profiling objects are created and displayed in the Profiling Monitor, and are
identified both by name and a process ID number (PID). This workbench process
object is a logical representation of the selected Java process; it is not a
system process.
- In the monitored state, you can run garbage collection (click the Run
Garbage Collection button
)
or, if available, dump object references (click the Collect Object
References button
from the main toolbar).
- If the agent is in the running state but is not collecting data (shown with the Paused symbol
), using the
Refresh Views button
will not have any effect. You must start monitoring the agents to get the latest data.
Select Start Monitoring from the pop-up menu of the agent.
- If the agent is in the terminated state (shown by the Terminated symbol
), it means that it
has finished monitoring the application, which has run to completion.
- To analyze data from the profiling session, you can open any available Profiling and Logging view.
To refresh the view content, click Refresh Views
.
Related concepts
Overview of the Profiling Tool
Profiling resources
Profiling monitor view
Log view
Related tasks
Profiling an application in stand-alone mode
Specifying profiling filters
Working with agents
Opening multiple Profiling and Logging Perspectives
Profiling an application in stand-alone mode
Attaching to a running process to collect log records
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.