| United States-English |
|
|
|
![]() |
Fortran 90 Compiler for HP-UX: Fortran 90 Programmer's Guide > Chapter 6 Performance and optimizationUsing profilers |
|
A profiler is a tool for sampling a program during execution so that you can determine where your program spends most of its time. After examining the data provided by a profiler, you can decide whether to redesign parts of the program to improve their performance or to re-compile the program with optimization options. For example, if your program contains a loop with an embedded call and profiling reveals that the program spends much of its time in the loop, you may decide to inline the embedded call. The following sections describe the CXperf performance analysis tool, which is bundled with HP Fortran 90, as well as the two UNIX profilers, gprof and prof.
When working on HP V-Class systems, you can use the CXperf profiler to get loop-level and routine-level information on HP Fortran 90 programs. For CXperf support, compile using the +pa option (for routine-level data) or the +pal option (for loop-level and routine-level data). For example: % f90 +pal foo.f The +pa and +pal options cause HP Fortran 90 to run cxoi (the CXperf object instrumentor) as part of the compilation process to create an executable program that supports CXperf's methods of collecting statistics. To collect profile statistics for a program that was compiled with +pa or +pal, run CXperf and specify the executable program you want to profile. For example: % /opt/cxperf/bin/cxperf a.out CXperf creates a profile of a program by collecting information on the wall clock time and CPU time spent per routine (and, if requested, per loop). It also can gather statistics on cache hits and misses and other aspects of the program's execution, such as the sequence in which routines are called (viewable as a graphical "call graph"). More information about CXperf is available from its Help menu. The gprof profiler enables you to determine which subprograms are called the most and how much time is spent in each subprogram.To use gprof, do the following:
For more information about gprof, see the gprof(1) man page. The prof profiler can also be used for profiling. Unlike the gprof profiler, prof does not generate the call graph profile. To use prof, do the following:
For more information about prof, see the prof(1) man page. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||