[prev] [index] [next]

The gprof Command

The gprof command display execution profiles for programs that have been compiled with the -pg flag.

When such a program is executed, it runs as normal but leaves profiling information in a file called gmon.out.

The command gprof reads gmon.out and prints a profile on standard output.

Example of use:

$ gcc -pg -o xyz xyz.c
$ xyz < data > /dev/null
$ gprof xyz | less

For further usage details, man gprof.