You can profile an application that is running on a remote system by attaching the profiling tool to the application. When you use this attach mode, the remote application starts after the profiler is attached. This mode enables you to obtain profiling data on the startup of the target JVM.
To attach the profiling tool you use the Attach Settings dialog box to specify the attachment settings for your project. In the Attach Settings dialog box you specify the location, OS and JVM of the remote target. Based on the details that you provide, the Attach Settings dialog box provides you with a set of instructions on how to configure the remote application to support profiling.
To attach the profiler to a remote application you need to configure the application to load some profiler libraries on startup to enable the profiling tool to attach to the application. You use the Attach Settings dialog box to specify the details of the remote system and to generate a Remote Profiler Pack archive that contains the necessary profiler libraries. You need to copy the contents of the Remote Profiler Pack archive to the remote system and then configure the remote application to load the profiler libraries.
After you configure the remote application according to the instructions, you can start the remote application and attach the profiler. You only need to configure the attach mode once. The attachment settings are associated with that project. You can open the Attach Settings dialog box at any time to change the attachment settings.
Perform the following steps to profile a remote application.
When you start the remote application, the application will wait until the IDE is attached before starting.
When you click Attach, the IDE will attach to the remote JVM and the remote application will start. You can view profiling data as you would for a local application.
After the IDE is attached to the remote application you can do the following:
When you detach from the remote application, the remote application does not stop but you stop receiving profiling data about the remote application. To attach to the remote application you need to use the startup options provided by the Attach Settings dialog box and start the remote application again.
You can modify the profiling session without detaching from the remote application. For example, you can change the profiling task to monitoring to reduce the profiling overhead, and then modify the task again later. This way you do not need to re-attach and restart the remote application.
Similar to attaching the profiler to a remote application, you need to copy the profiler libraries in the Remote Profiler Pack to the remote system to attach the profiling tool to a remote server. You also need to modify the server configuration files to specify the path to the JDK and to specify the path to the profiler agent. When you start the server using the modified startup script, the server will wait until the profiler attaches to the server.
You can retrieve the path to the profiler agent when you use the Attach Settings dialog box to configure your attach settings.
The path to the profiler agent will be similar to the following path.
-agentpath:<remote>\lib\deployed\jdk16\windows\profilerinterface.dll=<remote>\lib,5140
The placeholder <remote> refers to the full path to the root directory containing the
profiler libraries that you copied to the remote system.
The number 5140 is the Communication Port that the profiling tool uses to connect to the application.
You can modify the port number in the Profiler tab in the Java category in the Options window.
The following table identifies the startup scripts and the parameters that need to be modified to specify the paths to the JDK and the profiler libraries.
Server | File | Modification |
---|---|---|
Tomcat 7 | catalina.bat/catalina.sh | set JAVA_HOME to path to JDK for server modify CATALINA_OPTS to include profiler -agentpath parameter |
GlassFish 3 | asenv.bat/asenv.conf domain.xml |
set AS_JAVA to path to JDK for server add <jvm-options> elements to include profiler -agentpath parameter |
WebLogic 12 | startWebLogic.cmd/startWebLogic.sh | set JAVA_HOME to path to JDK for server modify JAVA_OPTIONS to include profiler -agentpath parameter |
JBoss 7 | standalone.conf.bat/standalone.conf | set JAVA_HOME to path to JDK for server modify JAVA_OPTS to include profiler -agentpath parameter |
Notes.