Next: , Previous: , Up: Profiling a Program: Where Does It Spend Its Time?   [Contents]

4 gprof Command Summary

After you have a profile data file gmon.out, you can run gprof to interpret the information in it. The gprof program prints a flat profile and a call graph on standard output. Typically you would redirect the output of gprof into a file with ‘>’.

You run gprof like this:

gprof options [executable-file [profile-data-files…]] [> outfile]

Here square-brackets indicate optional arguments.

If you omit the executable file name, the file a.out is used. If you give no profile data file name, the file gmon.out is used. If any file is not in the proper format, or if the profile data file does not appear to belong to the executable file, an error message is printed.

You can give more than one profile data file by entering all their names after the executable file name; then the statistics in all the data files are summed together.

The order of these options does not matter.