GPROF
GPROF is the GNU Profiler. It is intended to take information generated by running a program that has been built with profiling enabled and display it to the user. It is part of the GNU Binutils project.
Programs compiled with the -pg command line have extra code inserted into them that records how often functions are executed. When the program is run the information is stored in a separate file. Afterwards the gprof program can be used to analyse this file and show where the program was spending its time.