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:

  1. From the Profiling and Logging Perspective, click on the Profile drop-down button, and select Profile...:

    cursor pointing to drop down selector on Profile icon

  2. Click on the Profiling tab. This tab allows you to specify the parameters used by the profiling tool when collecting information.
  3. 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:
    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:

    The Edit Profiling Set dialog

    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 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.

  4. You may specify whether profiling should stop after some number of method invocations or some amount of time in the Profiling > Limits tab.
  5. 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.
  6. Click Apply, then Run to start profiling.
view of the workbench while profiling an application


Some notes:

  1. The Profiling Console opens, displaying program input and output.
  2. The associated agents monitor the application (shown with the Monitoring symbol A stylized icon) until it has run to completion.
  3. 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.
  4. In the monitored state, you can run garbage collection (click the Run Garbage Collection button A button with stylized icon) or, if available, dump object references (click the Collect Object References button A button with stylized icon from the main toolbar).
  5. If the agent is in the running state but is not collecting data (shown with the Paused symbol a stylized icon), using the Refresh Views button A button with stylized icon 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.
  6. If the agent is in the terminated state (shown by the Terminated symbol a stylized icon), it means that it has finished monitoring the application, which has run to completion.
  7. To analyze data from the profiling session, you can open any available Profiling and Logging view. To refresh the view content, click Refresh Views A button with stylized icon.

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