gprof - yszheda/wiki GitHub Wiki


gprof: Call Counting and PC Sampling

  • Function Call Counting: it counts for every instrumented function, how many times the function is called and from where. gcc inserts at the beginning of each instrumented function a call to a special library function to count the calls. This creates ‘Arcs’: information about who is calling what, how many times. Think about directed edges in a graph. Counting is done with _mcount() or in the case of GNU for ARM with __gnu_mcount_nc().
  • Program Counter Sampling: at a period time, the current PC (Program Counter) gets sampled, creating a histogram of PC over addresses. This is typically done with a profile() function.

Memory Requirements for Arcs and Histogram

Program Flow


Trouble-shooting

no gmon.out

wrong function name