Xprofiler lets you profile both serial and parallel applications. Serial applications generate a single profile data file, while a parallel application produces multiple profile data files. 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.
To use Xprofiler, your application must be compiled with the -pg flag. For more information, see Compiling Applications to be Profiled.
Like the gprof command, Xprofiler lets you analyze CPU (busy) usage only. It does not provide other kinds of information, such as CPU idle, I/O, or communication information.
If you compile your application on one processor, and then analyze it on another, you must first make sure that both processors have similar library configurations, at least for the system libraries used by the application. For example, if you run a High Performance Fortran application on a server, then try to analyze the profiled data on a workstation, the levels of High Performance Fortran run-time libraries must match and must be placed in a location on the workstation that Xprofiler recognizes. Otherwise, Xprofiler produces unpredictable results.
Because Xprofiler collects data by sampling, functions that run for a short amount of time may not show any CPU use.
Xprofiler does not give you information about the specific threads in a multi-threaded program. Xprofiler presents the data as a summary of the activities of all the threads.
With Xprofiler, you can produce the same tabular reports that you may be accustomed to seeing with the gprof command. As with gprof, you can generate the Flat Profile, Call Graph Profile, and Function Index reports.
Unlike gprof, Xprofiler provides a GUI that you can use to profile your application. Xprofiler generates a graphical display of your application's performance, as opposed to a text-based report. Xprofiler also lets you profile your application at the source statement level.
From the Xprofiler GUI, you can use all of the same command line flags as gprof, as well as some additional flags that are unique to Xprofiler.
To use Xprofiler, you must compile and link your application with the -pg flag 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. The following is an example of how you would compile and link all at once:
cc -pg -o foo foo.c
The following is an example of how you would first compile your application and then link it. To compile, do the following:
cc -pg -c foo.c
To link, do the following:
cc -pg -o foo foo.o
Notice that when you compile and link separately, you must use the -pg flag with both the compile and link commands.
The -pg flag compiles and links the application so that when you run it, the CPU usage data is written to one or more output files. For a serial application, this output consists of only 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, the task ID is appended to each gmon.out file (for example: gmon.out.10).
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 lets you view included functions. Your application must also be compiled with the -g flag in order for Xprofiler to display the included functions.
In addition to the -pg flag, the -g flag is also required for source-statement profiling.