How to use Gprof

Gprof produces an execution profile of programs written in C, Fortran etc. It calculates the amount of time spent in each subroutine.

To use gprof with f90, follow these three steps:
  1. Compile f90 code
    Compile the f90 code with the option -pg.
    e.g. f90 -pg code.f90
  2. Run the executable file
    e.g. /a.out &
  3. Run gprof
    e.g. gprof > profile.txt

Please send comments and corrections to Natali Gulbahce, e-mail.

Updated 3 April 2002.