Launching or attaching to a process for profiling
The Profiling Tool provides the ability to attach to a running application or to launch an application for profiling.
Attaching to an application is a feature where you can associate with an already Java process enabled for profiling.
Launching a process means that the process is started with an agent associated with its launch.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 identification number (process identifier (PID)) that appears in the view along with the associated agents.
Attaching to an application
Important: before being able to attach to a profiling agent, a Java process will need to be running in controlled or enabled mode. Click here to find more details about how an application can be executed in controlled or enabled mode.
- From the Profiling and Logging Perspective, click on the Profile
drop-down menu, and select Profile... The Profile wizard opens.
- Double click on Attach to Agent. A new configuration is created.
- Under the Host tab, specify the Host name or IP address and the Agent Controller port (if different from the default).
- Switch to the Agents tab to view a list of available agents that can be attached to (Note: if the list is empty then no agents are available to attach to on the selected host. You can always use the Refresh button to get the list of available agents)
- Check the analysis types that you wish to use to attach to the available agent. Configure the profiling filters as required. Refer to the Specifying profiling criteria topic for more information on configuring the profiling filters.
- Click Apply to apply the changes.
- Click Profile to attach to the application.
- The Profiling Monitor view is refreshed displaying the agent representing your application.
Launching an application
To either launch a local or a remote Java process, follow these steps:
- From the Profiling and Logging Perspective, click on the Profile
drop-down menu, and select Profile... The Profile wizard opens.
- There are several types of Java processes that can be launched:
- To launch a Java Application, follow these steps:
- Double click on Java Application. A new configuration is created.
- 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 are not using a local deployment, the Agent Controller bin directory needs to be specified in the system path in order for the application to be profiled within Eclipse. If it has not been specified, use the Environment tab to add the environment variable to the application path.
- Click the Environment tab.
- Click New.
- In the New Environment Variable dialog, specify the Name as PATH.
- Specify the Value as the bin directory of the Agent Controller installation, for example D:\agentcontroller_install\bin.
- Click OK to apply the changes.
- To launch an external Java Process, follow these steps:
- Double click on External Java Application. A new configuration is created.
- 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 VM arguments, and Environment Variables, as needed, using the Arguments and Environment tabs.
Note: The Working Directory under the Arguments tab only applies to external applications launched on the local host specified in the Host tab. This field will be ignored for external applications launched on a remote host.
- To launch an Eclipse runtime workbench, follow these steps:
- Double click on Eclipse Application. A new configuration is created.
- 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.
- Select the Monitor tab. Configure the profiling filters as required. Refer to the Specifying profiling criteria topic for more information on configuring the profiling filters.
- Click Apply to apply the changes.
- Click Profile to attach to the application.
- The Profiling Monitor view is refreshed displaying the agent representing your application. The workbench console opens, displaying program input and output.
Once your application is being profiled, you can perform a number of other data collection activities on the application such as collecting object references and garbage collection.
Related concepts
Overview of the Profiling Tool
Profiling resources
Related tasks
Collecting object references*Object Allocation Analysis and Memory leak detection**
Studying garbage collection for Java 1.4 and lower jvm*
Studying garbage collection for Java 5.0 (Java 1.5) and higher jvm**
Profiling an application in stand-alone mode
Profiling with a local deployment
Using the Profiling Monitor view
*Supported for Java 1.4 and lower java profiling
** Support for profiling Java 5.0 (also referred to as Java 1.5) and above java virtual machines.
(C) Copyright IBM Corporation 2000, 2008. All Rights Reserved.