IBM Books

Operation and Use, Volume 2


Getting performance data for your application

With Xprofiler, you can get performance data for your application on a number of levels, and in a number of ways. You can easily view data pertaining to a single function, or you can use the reports provided to get information on your application as a whole.

Getting basic data

Xprofiler makes it easy to get data on specific items in the function call tree. Once you've located the item you are interested in, you can get data a number of ways. If you are having trouble locating a function in the function call tree, see Locating specific objects in the function call tree.

Basic function data

Below each function box in the function call tree is a label that contains basic performance data. The example below shows the function box for the function sub1, and its label.

Figure 23. Example of a Function Box Label

View figure.

The label contains the name of the function, its associated cycle, if any, and its index. In the example above, the name of the function is sub1. It is associated with cycle 1, and its index is 5. Also, depending on whether the function call tree is viewed in summary mode or average mode, the label will contain the information listed below. See Controlling the representation of the function call tree for more about summary mode and average mode.

Since labels are not always visible in the Xprofiler window when it is fully zoomed out, you may need to zoom in on it in order to see the labels. See Zooming in on the function call tree for information on how to do this.

Basic call data

Call arc labels appear over each call arc. The label shows you the number of calls that were made between the two functions (from caller to callee). For example:

Figure 24. Example of a call arc label

View figure.

In order to see a call arc label, you will probably need to zoom in on it. See Zooming in on the function call tree for information on how to do this.

Basic cluster data

Cluster box labels tell you the name of the library that is represented by that cluster. If it is a shared library, the label shows its full pathname.

Information boxes

For each function box, call arc, and cluster box, there is a corresponding information box that you can access with your mouse. It gives you the same basic data that appears on the label. This is useful when the Xprofiler display is fully zoomed out and the labels are not visible. To access the information box, click on the function box, call arc, or cluster box (place it over the edge of the box) with the left mouse button. The information box appears.

For a function, the information box contains:

Function menu Statistics Report option

You can get performance statistics for a single function via the Statistics Report option of the Function menu. It lets you see data on the CPU usage and call counts of the selected function. If you are using more than one gmon.out file, this option breaks down the statistics per each gmon.out file you use.

When you select the Statistics Report menu option, the Function Level Statistics Report window appears, as in the example below.

Figure 25. Function Level Statistics Report window

View figure.

The Function Level Statistics Report window provides the following information:

Function Name

The name of the function you selected. In Figure 25, the function name is main.

Summary Data

The total amount of CPU used by this function. If you used multiple gmon.out files, the value shown here represents their sum.

The CPU Usage field shows you:

The Call Counts field shows you:

Statistics Data

The CPU usage and calls made to or by this function, broken down by gmon.out file.

The CPU Usage field shows you:

The Call Counts field shows you:

Getting detailed data via reports

Xprofiler provides performance data in textual and tabular format. This data is provided in various tables called reports. If you are a gprof user, you are familiar with the Flat Profile, Call Graph Profile, and Function Index reports. Xprofiler generates these same reports, in the same format, plus two others.

You can access the Xprofiler reports from the Report menu. The Report menu lets you see the following reports:

Each report window includes a File menu. Under the File menu is the Save As option which allows you to save the report to a file. For information on using the Save File Dialog window to save a report to a file, see Using the save dialog windows.

Each report window also includes a Search Engine field, which is located at the bottom of the window. The Search Engine lets you search for a specific string in the report. For information on using the Search Engine field, see Using the search engine.

Note:
If you select the Save As option from the Flat Profile, Function Index, or Function Call Summary report windows, you must either complete the save operation or cancel it before you can select any other option from the menus of these reports. You can, however, use the other menus of Xprofiler before completing the save operation or canceling it, with the exception of the Load Files option, of the File menu, which remains greyed out.

Each of the Xprofiler reports are explained below.

Flat Profile report

When you select the Flat Profile menu option, the Flat Profile window appears. The Flat Profile report shows you the total execution times and call counts for each function (including shared library calls) within your application. The entries for the functions that use the greatest percentage of the total CPU usage appear at the top of the list, while the remaining functions appear in descending order, based on the amount of time used.

Unless you specified the -z command line option, the Flat Profile report does not include functions whose CPU usage is 0 (zero) and have no call counts.

Note that the data presented in the Flat Profile window is the same data that is generated with the UNIX gprof command.

The Flat Profile report looks similar to this:

Figure 26. Flat Profile Report

View figure.

Flat Profile window fields

The Flat Profile window fields are explained below.

Call Graph Profile report

The Call Graph Profile menu option lets you view the functions of your application, sorted by the percentage of total CPU usage that each function, and its descendants, consumed. When you select this option, the Call Graph Profile window appears.

Unless you specified the -z command line option, the Call Graph Profile report does not include functions whose CPU usage is 0 (zero) and have no call counts.

Note that the data presented in the Call Graph Profile window is the same data that is generated with the UNIX gprof command.

The Call Graph Profile report looks similar to this:

Figure 27. Call Graph Profile Report

View figure.

Call Graph Profile window fields

The fields of the Call Graph Profile are explained below.

In the example below, sub2 is the function of interest, sub1 and main are its parents, and printf and sub1 are its children.

Figure 28. called/total, call/self, called/total field

View figure.

Figure 29. name/index/parents/children field

View figure.

Function Index report

The Function Index menu option lets you view a list of the function names included in the function call tree. When you select this option, the Function Index window appears, and displays the function names in alphabetical order. To the left of each function name is its index, enclosed in brackets []. The index is the function's identifier, which is assigned by Xprofiler. An index also appears on the label of each corresponding function box in the function call tree as well as other reports.

Unless you specified the -z command line option, the Function Index report does not include functions whose CPU usage is 0 (zero) and have no call counts.

The Function Index menu option includes a Code Display menu, like the Flat Profile menu option, allowing you to view source code or disassembler code. For more information on viewing code, see Viewing source code and Viewing disassembler code.

The Function Index report looks similar to this:

Figure 30. Sample Function Index Report

View figure.

Function Call Summary report

The Function Call Summary menu option lets you display all the functions in your application that call other functions. They appear as caller-callee pairs (call arcs, in the function call tree), and are sorted by the number of calls in descending order. When you select this option, the Function Call Summary window appears.

The Function Call Summary report looks similar to this:

Figure 31. Sample Function Call Summary Report

View figure.

Function Call Summary window fields

The fields of the Function Call Summary window are explained below.

Library Statistics report

The Library Statistics menu option lets you display the CPU time consumed and call counts of each library within your application. When you select this option, the Library Statistics window appears.

The Library Statistics report looks similar to this:

Figure 32. Sample Library Statistics Report

View figure.

Library Statistics window fields

The fields of the Library Statistics window are explained below.

Saving reports to a file

Xprofiler lets you save any of the reports you generate with the Report menu to a file. You can do this via the File and Report menus of the Xprofiler GUI.

Saving a single report

To save a single report, go to the Report menu, on the Xprofiler main window, and select the report you would like to save. Each report window includes a File menu. Select the File menu and then the Save As option to save the report. A Save dialog window appears, which is named according to the report from which you selected the Save As option. For instance, if you chose Save As from the Flat Profile window, the dialog window is named Save Flat Profile Dialog.

Saving the Call Graph Profile, Function Index, and Flat Profile reports to a file

You can save the Call Graph Profile, Function Index, and Flat Profile reports to a single file with the File menu of the Xprofiler main window. The information you generate here is identical to the output of the UNIX gprof command. From the File menu, select the Save As option. The Save File Dialog window appears.

To save the report(s):

  1. Specify the file into which the profiled data should be placed. You can specify either an existing file or a new one. To specify an existing file, use the scroll bars of the Directories and the Files selection boxes to locate the file you want. To make locating your files easier, you can also use the Filter button (see Using the dialog window filters for more information). To specify a new file, type its name in the Selection field.
  2. Click on the OK button. A file containing the profiled data appears in the directory you specified, under the name you gave it.

Note:
Once you select the Save As option from the File menu, and the Save Profile Reports window opens, you must either complete the save operation or cancel it before you can select any other option from the menus of its parent window. For example, if you select the Save As option from the Flat Profile report, and the Save File Dialog window appears, you cannot use any other option of the Flat Profile report window.

The File Selection field of the Save File Dialog window follows Motif standards.

Saving summarized data from multiple profile data files

If you are profiling a parallel program, you could specify more than one profile data (gmon.out) file when you started Xprofiler. The Save gmon.sum As option of the File menu lets you save a summary of the data in each of these files to a single file.

The Xprofiler Save gmon.sum As option produces the same result as the Xprofiler and gprof -s command line option. If you run Xprofiler later, you can use the file you create here as input with the -s option. In this way, you can accumulate summary data over several runs of your application.

To create a summary file:

  1. Select the File menu, and then the Save gmon.sum As option. The Save gmon.sum Dialog window appears.
  2. Specify the file into which the summarized, profiled data should be placed. By default, Xprofiler puts the data into a file called gmon.sum, but you can designate a different file. You can either specify a new file or an existing one. To specify a new file, type its name in the selection field. To specify an existing file, use the scroll bars of the Directories and Files selection boxes to locate the file you want. To make locating your files easier, you can also use the Filter button (see Using the dialog window filters for information).
  3. Click on the OK button. A file, containing the summary data, appears in the directory you specified, under the name you gave it.

Saving a configuration file

The Save Configuration menu option lets you save the names of the functions that are displayed currently to a file. Later, in the same Xprofiler session or a different session, you can read in this configuration file using the Load Configuration option. See the following section, "Loading a Configuration File", for more information.

To save a configuration file:

  1. Select the File menu, and then the Save Configuration option. The Save Configuration File Dialog window opens with the program.cfg file as the default value in the Selection field. "Program" is the name of the input a.out file.

    You can use the default file name, enter a file name in the Selection field, or select a file from the dialog's files list.

  2. Specify a file name in the Selection field and click on the OK button. A configuration file is created containing the name of the program and the names of the functions that are displayed currently.
  3. Specify an existing file name in the Selection field and click on the OK button. An Overwrite File Dialog window appears so you can check the file before overwriting it.

If you select the Forced File Overwriting option in the Runtime Options Dialog window, the Overwrite File Dialog does not open and the specified file is overwritten without warning.

Loading a configuration file

The Load Configuration menu option lets you read in a configuration file that you saved. See the previous section, "Saving a Configuration File", for more information. The Load Configuration option automatically reconstructs the function call tree according to the function names recorded in the configuration file.

To load a configuration file:

  1. Select the File menu, and then the Load Configuration option. The Load Configuration File Dialog window opens. If a configuration files were loaded previously during the current Xprofiler session, the name of the file that was most recently loaded will appear in the Selection field of this dialog.

    You can also load the file with the -c command line option. See Specifying command line options (from the GUI) for more information.

  2. Select a configuration file from the dialog's Files list or specify a file name in the Selection field, and click on the OK button. The function call tree is redrawn to show only those function boxes for functions that are listed in the configuration file and are called within the program that is currently represented in the display. All corresponding call arcs are also drawn.

    If the a.out name, that is, the program name in the configuration file, is different from the a.out name in the current display, a confirmation dialog appears to allow you to decide whether or not you still wish to load the file.

  3. If after loading a configuration file, you wish to return the function call tree back to its previous state, select the Filter menu, and then the Undo option.

Looking at source code

Xprofiler provides several ways for you to view your source code. You can view the source or disassembler code for your application on a per-function basis. This also applies to any included function code your application may use.

When you view source or included function code, you use the Source Code window. When you view disassembler code, you use the Disassembler Code window. You can access these windows through the Report menu of the Xprofiler GUI or the Function menu of the function in which you are interested.

Viewing source code

Both the Function menu and Report menu provide the means for you to access the Source Code window, from which you will view your code.

To access the Source Code window via the Function menu:

  1. Click on the function box you are interested in with the right mouse button. The Function menu appears.
  2. From the Function menu, select the Show Source Code option. The Source Code window appears.

To access the Source Code window via the Report menu:

  1. Select the Report menu, and then the Flat Profile option. The Flat Profile window appears.
  2. From the Flat Profile window, select the function you would like to view by clicking on its entry in the window. The entry highlights to show that it is selected.
  3. Select the Code Display menu, and then the Show Source Code option. The Source Code window appears, containing the source code for the function you selected.

Using the Source Code window

The Source Code window shows you only the source code file for the function you specified from the Flat Profile window or the Function menu. The Source Code Window looks similar to this:

Figure 33. Sample Source Code Window

View figure.

The Source Code Window contains information in the following fields:

The Search Engine field, at the bottom of the Source Code window, lets you search for a specific string in your source code. For information on using the Search Engine field, see Using the search engine

The Source Code window contains the following menus:

For C++ users, the Show Included Functions option lets you view the source code of included function files that are included by the application's source code.

If a selected function does not have an included function file associated with it or does not have the function file information available because the -g option was not used for compiling, the Utility menu will be greyed out. The availability of the Utility menu serves as an indication of whether or not there is any included function file information associated with the selected function.

When you select the Show Included Functions option, the Included Functions Dialog window appears, which lists all of the included function files. Specify a file by either clicking on one of the entries in the list with the left mouse button, or by typing the file name in the Selection field. Then click on the OK or Apply button. After selecting a file from the Included Functions Dialog window, the Included Function File window appears, displaying the source code for the file that you specified.

Viewing disassembler code

Both the Function menu and Report menu provide the means for you to access the Disassembler Code window, from which you can view your code.

To access the Disassembler Code window via the Function menu:

  1. Click on the function you are interested in with the right mouse button. The Function menu appears.
  2. From the Function menu, select the Show Disassembler Code option. The Disassembler Code window appears.

To access the Disassembler Code window via the Report menu:

  1. Select the Report menu, and then the Flat Profile option. The Flat Profile window appears.
  2. From the Flat Profile window, select the function you would like to view by clicking on its entry in the window. The entry highlights to show that it is selected.
  3. Select the Code Display menu, and then the Show Disassembler Code option. The Disassembler Code window appears, and contains the disassembler code for the function you selected.

Using the Disassembler Code window

The Disassembler Code window shows you only the disassembler code for the function you specified from the Flat Profile window. The Disassembler Code Window looks similar to this:

Figure 34. Sample Disassembler Code Window

View figure.

The Disassembler Code window contains information in the following fields:

The Search Engine field, at the bottom of the Disassembler Code window, lets you search for a specific string in your disassembler code. For information on using the Search Engine field, see Using the search engine.

The Disassembler Code window contains only one menu:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]