[prev] 55 [next]

gprof: A Profiler

The gprof command displays execution profiles ...
  • must compile program with the -pg flag
  • executing program creates an extra gmon.out file
  • gprof reads gmon.out and prints profile on stdout

Example of use:

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

For further usage details, man gprof.