Attaching to a Local Application
You can use the attach mode to profile a local application
when you want or need to start the application outside of the IDE.
For example, you may want to use the attach mode in the following cases:
- Your application needs to be started from the command line or uses a complex launch script
- You want to obtain profiling data on the startup of the appliction or target JVM
- You want to profile the application without restarting the application
(Dynamic attach mode, requires JDK 1.6)
To attach to a local application, you first need to configure
the attachment settings using the Attach wizard.
These settings are associated with the project you are profiling.
You only need to configure the attach settings for your project once,
but you can modify the settings at any time by stepping through the Attach wizard again.
When you configure the settings for attaching to a local application,
you can choose from the following attachment modes:
- Direct. This mode enables you to obtain profiling data on the startup of the local application.
- Dynamic. (requires JDK 1.6) This mode allows you to detach from and re-attach to the application
without stopping the application.
To attach to a local application:
- Choose Profile > Attach Profiler (
) from the main menu to open the
Select Profiling Task dialog box.
- Select the target application from the Attach To drop-down list at the top of the dialog box.
- Click define to open the Attach Wizard to specify the Attach mode.
- In the Attach wizard, select the target type of the application.
- Select Local as the Attach Method.
- Select either Direct or Dynamic as the Attach Invocation. Click Next.
- Step through the wizard and follow the instructions for configuring the attach settings.
Click Finish to close the wizard.
- In the Select Profiling Task dialog box, select a profiling task and any options.
- Click Attach.
To detach from the application:
- Choose Profile > Detach from the main menu or click Detach in the Profiler window.
When you detach from the application, the connection to the target JVM is closed.
When you click Detach, you can choose to stop the application upon detach or allow the application to keep running.
You can reattach to the application by choosing Profile > Attach Profiler from the main menu.
Modifying the profiling task
Once the connection is established and the profiler is attached to the target application,
you can change the profiling task you are running on the target application without stopping or restarting the application.
To change the profiling task without detaching:
- Choose Profile > Modify Profiling (Alt+Shift+F2) from the main menu or click Modify Profiling
(
) in the Profiler window.
- Select a new profiling command and adjust any settings.
- Click Run.
The target application is instrumented again without starting or
stopping the application.
- See Also
- Profiling Using Attach Mode
Legal Notices