Get Call Graph essential facts below. View Videos or join the Call Graph discussion. Add Call Graph to your PopFlock.com topic list for future reference or share this resource on social media.
A call graph generated for a simple computer program in Python.
A call graph (also known as a call multigraph) is a control flow graph, which represents calling relationships between subroutines in a computer program. Each node represents a procedure and each edge (f, g) indicates that procedure f calls procedure g. Thus, a cycle in the graph indicates recursive procedure calls.
Call graphs can be dynamic or static. A dynamic call graph is a record of an execution of the program, for example as output by a profiler. Thus, a dynamic call graph can be exact, but only describes one run of the program. A static call graph is a call graph intended to represent every possible run of the program. The exact static call graph is an undecidable problem, so static call graph algorithms are generally overapproximations. That is, every call relationship that occurs is represented in the graph, and possibly also some call relationships that would never occur in actual runs of the program.
Call graphs can be defined to represent varying degrees of precision. A more precise call graph more precisely approximates the behavior of the real program, at the cost of taking longer to compute and more memory to store. The most precise call graph is fully context-sensitive, which means that for each procedure, the graph contains a separate node for each call stack that procedure can be activated with. A fully context-sensitive call graph is called a calling context tree. This can be computed dynamically easily, although it may take up a large amount of memory. Calling context trees are usually not computed statically, because it would take too long for a large program. The least precise call graph is context-insensitive, which means that there is only one node for each procedure.
With languages that feature dynamic dispatch, such as Java and C++, computing a static call graph precisely requires alias analysis results. Conversely, computing precise aliasing requires a call graph. Many static analysis systems solve the apparent infinite regress by computing both simultaneously.
Call graphs can be used in different ways. One simple application of call graphs is finding procedures that are never called. Call graphs can act as documentation for humans to understand programs. They can also serve as basis for further analyses, such as an analysis that tracks the flow of values between procedures, or change impact prediction. Call graphs can also be used to detect anomalies of program execution or code injection attacks.
KCachegrind : powerful tool to generate and analyze call graphs based on data generated by callgrind
Mac OS X Activity Monitor : Apple GUI process monitor Activity Monitor has a built-in call graph generator that can sample processes and return a call graph. This function is only available in Mac OS X Leopard
OpenPAT : includes the control_flow tool which automatically creates a Graphviz call-graph picture from runtime measurements.
pprof, open source tool for visualization and analysis of profile data, to be used in conjunction with gperftools.
CCTree : Native Vim plugin that can display static call graphs by reading a cscope database. Works for C programs.
codeviz : a static call graph generator (the program is not run). Implemented as a patch to gcc; works for C and C++ programs.
Cppdepend :is a static analysis tool for C/C++ code. This tool supports a large number of code metrics, allows for visualization of dependencies using directed graphs and dependency matrix.
calltree.sh : Bash shell functions that glue together cscope, graphviz, and a sampling of dot-rendering tools to display "caller" and "callee" relationships above, below, and/or between the C functions you specify.
tceetree : like calltree.sh, it connects Cscope and Graphviz, but it is an executable rather than a bash script.
go-callvis : a call graph generator for Go programs whose output can be drawn with Graphviz
NDepend :is a static analysis tool for .Net code. This tool supports a large number of code metrics, allows for visualization of dependencies using directed graphs and dependency matrix.
^Ryder, B.G. (May 1979). "Constructing the Call Graph of a Program". IEEE Transactions on Software Engineering. SE-5 (3): 216-226. doi:10.1109/tse.1979.234183.
^Grove, David; DeFouw, Greg; Dean, Jeffrey; Chambers, Craig; Grove, David; DeFouw, Greg; Dean, Jeffrey; Chambers, Craig (9 October 1997). "Call graph construction in object-oriented languages". ACM SIGPLAN Notices. ACM. 32: 108, 108-124, 124. doi:10.1145/263700.264352.
^Eisenbarth, T.; Koschke, R.; Simon, D. "Aiding program comprehension by static and dynamic feature analysis". Proceedings IEEE International Conference on Software Maintenance. ICSM 2001. doi:10.1109/icsm.2001.972777.