IBM Books

Operation and Use, Volume 2


Before you begin

About Xprofiler

Xprofiler lets you profile both serial and parallel applications. The difference is that when you run a serial application, a single profile data file is generated, while a parallel application produces multiple profile data files. Either way, you can use Xprofiler to analyze the resulting profiling information.

Xprofiler provides a set of resource variables that let you customize some of the features of the Xprofiler window and reports. For information about customizing resources for Xprofiler, see IBM Parallel Environment for AIX: Operation and Use, Volume 2, Tools Reference

The word function is used frequently throughout this chapter. Consider it to be synonymous with the terms routine, subroutine, and procedure.

Requirements and limitations

To use Xprofiler, your application must be compiled with the -pg option. For more information about compiling, see Compiling applications to be profiled.

Like gprof, Xprofiler lets you analyze CPU (busy) usage only. It cannot give you other kinds of information such as CPU idle, I/O, or communication.

If you compile your application on one machine, and then analyze it on another, you must first make sure that both machines have similar library configurations, at least for the system libraries used by the application. For instance, say you ran an HPF application on an SP, then tried to analyze the profiled data on a workstation. The levels of HPF runtime libraries must match, and must be placed in a location that Xprofiler recognizes on the workstation. Otherwise, Xprofiler produces unpredictable results.

Since Xprofiler collects data by sampling, short-executing functions may show no CPU use.

Xprofiler does not give you information about the specific threads in a multi-threaded program. The data that Xprofiler presents is a summary of the activities of all the threads.

Xprofiler versus gprof

With Xprofiler, you can produce the same tabular reports that you may be accustomed to seeing with gprof. Just as with gprof, you can generate the Flat Profile, Call Graph Profile, and Function Index reports. Xprofiler is different from gprof in that it provides a graphical user interface (GUI) from which you can profile your application. It generates a graphical display of your application's performance, as opposed to just a text-based report. Unlike gprof, Xprofiler also lets you profile your application at the source statement level.

From the Xprofiler GUI, you can use all the same command line flags as gprof, plus a few more that are unique to Xprofiler.

Compiling applications to be profiled

In order to use Xprofiler, you must compile and link your application with the -pg option of the compiler command. This applies regardless of whether you are compiling a serial or parallel application. You can compile and link your application all at once, or perform the compile and link operations separately. Here's an example of how you would compile and link all at once:

cc -pg -o foo foo.c
 

And here's an example of how you would first compile your application and then link it. To compile:

cc -pg -c foo.c
 

To link:

cc -pg -o foo foo.o
 

Notice that when you compile and link separately, you must use the -pg option with both the compile and link commands.

The -pg option compiles and links the application so that when you run it, the CPU usage data gets written to one or more output files. For a serial application, this output consists of just one file called gmon.out, by default. For parallel applications, the output is written into multiple files, one for each task that is running in the application. To prevent each output file from overwriting the others, POE appends the task ID to each gmon.out file. For instance, gmon.out.10.

The -pg option is not a combination of the -p and the -g compiling options.

In order to get a complete picture of your parallel application's performance, you must indicate all of its gmon.out files when you load the application into Xprofiler. When you specify more than one gmon.out file, Xprofiler shows you the sum of the profile information contained in each file.

The Xprofiler GUI provides the capability of viewing included functions. Note, however, that your application must also be compiled with the -g option in order for Xprofiler to display the included functions.

The -g option, in addition to the -pg option, is also required for source statement profiling.


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