Viewing performance bottlenecks

Performance bottlenecks can be quickly identified by using the Execution Statistics view and the Method Invocation view. Prerequisites:

The following steps illustrate a workflow involved in identifying performance bottlenecks:

 

Identifying the packages with a high execution time

  1. In the Profiling Monitor view, select the monitor or agent.

  2. Right-click and select Open with > Execution Statistics. The Execution Statistics view opens.

  3. Select Execution Statistics tab in the bottom of the view

  4. Click Package from the toolbar to display the class statistics.

  5. To analyze performance data, you want to look at the time related columns. Right-click and select Choose Columns...

  6. Select Base Time,Cumulative Time,Inherited Base Time and Inherited Cumulative Time.

  7. Click OK. The Execution Statistics view is refreshed with the time columns.

  8. Sort the Base Time column by clicking on the column heading.

  9. Identify the package that has the greatest base time. Open the package tree.

  10. Identify the class or classes with the highest base time.

  11. Examine the performance within the class identified in further detail by switching to the Class mode.

 

Identifying the classes within the package with high execution time

  1. Open the Class mode by clicking Class in the toolbar.

  2. In the Class mode, select Choose columns.

  3. Select Base Time,Cumulative Time,Inherited Base Time and Inherited Cumulative Time.

  4. Sort the Base Time column by clicking on the column heading.

  5. Identify the class with the greatest Base Time and open the class tree.

  6. Examine which method calls within the class have the greatest Base Time.

 

Examining the methods within a class to identify high method invocations

The slow performance methods identified in the Execution Statistics view can be examined in more detail to further pinpoint the source of the bottleneck using the Method Invocations tab. This tab will allow you to see the execution pattern and the differences between invocations of the same method.
To view the methods in the Method Invocation tab, follow these steps:

  1. To open the Method Invocation tab, right-click on a class and select Show Method Invocation. The Method Invocation tab opens.

  2. From the Method Invocation tab, you can examine what called the invocation in the execution stack or you can jump to the source code of the method by right-clicking and selecting Show caller or Open source.

  3. You can also see the time spent by hovering the cursor over any bar.

  4. Open the Method Invocation table to get a tabular view of the same method. Right click in the Method Invocation view and select Show Method Invocation. The Method Invocation table opens.

  5. Using both the Method Invocation view and the Method Invocation table, identify the differences between method invocations, and the method invocations that take the longest time to execute.

 

Identifying the methods with a high execution time using a call tree

Using a Call Tree tab you can identify the method that took the significant part of the launch time and the stack of calls that preceded the bottleneck

  1. Select the Call tree tab in the bottom of the Execution Statistics view.

  2. Choose the thread to investigate, for example the thread with the biggest Cumulative time

  3. Start expanding the nodes of the tree looking at the Percent Per Thread column of the table and selecting the node with the highest percent.

  4. Go on expanding down to the very last element of the tree structure that takes the largest part of the launch time or stop at any appropriate level. The <self> nodes indicate the Base Time of each expanded method

  5. Comparing values in Average Time and Maximum Time columns for your method and identifying that the difference is big enough you should note that one (or any) invocations of the method took the most part of the time.

  6. In the bottom part of the tab you can find the table with the exact stack of the method selected in the call tree. If the method was invoked several times you can switch between different stacks of invocations by using Previous and Next buttons at the very bottom of the tab and identify the invocation stack that took the most part of the time analyzing the values in the tab

Related concepts
Overview of the Profiling Tool

Related tasks
Profiling an application
Launching or attaching a Java process