Finding Problem Points in Your Program

See Also

Performance problems are often localized in a few lines of code. To locate these problems you first find the function, then look at the annotated source code or annotated disassembly code.

tip Before you start, you might want to hide the functions in all the load objects except the one that you are interested in. Choose View and choose Show/Hide Functions to make a selection.

To find the function where there is a performance problem:

  1. Select the metrics that measure the performance problem.

    Choose View and choose Set Data Presentation to select the metrics that are displayed.

  2. In the Functions tab, sort the data by the most important metric.

    Click the column header to select the sort metric. The functions are ordered by the metrics in this column.

Once you have identified a function that is a candidate for further investigation, you can use the Source tab or Disassembly tab or both to find points that have high metric values.

To find the problem source lines in a function:

  1. Select the function in the Functions tab (or in any other tab that allows you to select a function).
  2. Click the Source tab.

    The annotated source code is displayed in the tab with the first executable line of the function selected and visible.

  3. Search for source code lines that have high metrics.

    You can use the Find tool in the toolbar to locate these lines. Choose High Metric Value from the combo box and click one of the arrow buttons.

    If you now want to find the instructions that correspond to this source line, do the following:

    1. Click the Disassembly tab.
    2. Search for the source line number.

      Enter the line number in square brackets in the text field of the Find tool in the toolbar. Example: [459]

To find the instructions that are responsible for high metrics:

  1. Select a function in the Functions tab (or in any other tab that allows you to select a function).
  2. Click the Disassembly tab.

    The tab is displayed with the first executable instruction of the function selected and visible.

  3. Search for instructions that have high metrics.

    You can use the Find tool in the toolbar to locate these lines. Choose High Metric Value from the combo box and click one of the arrow buttons.

    If you now want to find the source lines that correspond to an instruction, do the following:

    1. Note the line number of the instruction. Example: [459]
    2. Click the Source tab.
    3. Search for the source line number.

      You can choose Text: from the Find combo box and enter the line number followed by a period. Example: 459.

See also
Interpreting Annotated Source Code
Interpreting Annotated Disassembly Code
Setting Data Presentation Preferences
The Source Tab
The Disassembly Tab

Can't find what you are looking for? Submit your comments at http://www.sun.com/hwdocs/feedback.
Legal Notices