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, Java Perspective, Server Perspective, or
Debug Perspective, select Profile:

Select either Launch or Attach, then
select Java Process if the process is local or Remote
Process if it is remote.
- If you selected Remote Process, the Hosts page opens.
- Specify either the remote Host name or its IP
address.
- Specify the Agent Controller port, if it's different
from the default. Click Next.
- If you selected Attach, then the Agent window appears, displaying
detached (and hence available) agents
that are running and collecting data.
- Select the agents that are associated with the process IDs you wish to
attach to and move them to the right side pane.
- It may be useful to click Refresh to ensure that you have an
up-to-date list. Click Next.
- If you selected Launch, then the Class window opens.
- Either select the Java Project and Main class that you
intend to profile from within
the workbench or, if you intend to profile classes outside the workbench,
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. Click Next. The Destination page opens.
- Specify the project and monitor in which to store data from
this profiling session. You could also specify an external file. Click Next.
The Profiling Filters page opens.
- To select what should and should not be profiled, Select a filter set
or create a custom one. Click Next.
The Profiling Options page opens..
- If you are interested in memory related profiling, such
as heap analysis and memory statistics, select My application uses too much
memory.
- Click Show Details, then 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, select My
application is too slow.
- Click Show Details, then 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.
- Click Next.
- Specify whether profiling should stop after some number of method invocations or
some amount of time. Click Finish. The profiling
begins:
- 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
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, 2003. All Rights Reserved.