gprof - yszheda/wiki GitHub Wiki
-
https://hpc.llnl.gov/software/development-environment-software/gprof
-
https://stackoverflow.com/questions/9608949/gprof-time-spent-in-particular-lines-of-code
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
- 链接参数要加
-pg
- gmon.out is not written after compiling with gcc -pg -g
- gprof问题没有生成gmon.out
- 程序不产生gmon.out的原因