next up previous contents
Next: pixie --- Basic Up: Profiling Mechanisms Previous: prof --- PC

gprof --- Call Graph

gprof [] profiling is similar in some ways to prof profiling. Instead of prof's option -p, the usual option to enable gprof profiling is -pg. The linker links against a different mcount() function which maintains exact counts of entries into each function by individual call sites, probably by walking the stack at run-time to find the address the called function will return to. The gprof post-processor then constructs the call graph for the program, and propagates function execution time (obtained from the PC sampling) through the call graph, proportionally to the number of calls from each call site for the function. The resulting weighted call graph gives a more thorough picture of inefficiencies in the program; however the call graph may be substantially inaccurate when:



Reinventing Computing, MIT AI Lab. Author: pshuang@ai.mit.edu (Ping Huang)