110 lines
		
	
	
	
		
			5.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			110 lines
		
	
	
	
		
			5.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
								 | 
							
								<html lang="en">
							 | 
						||
| 
								 | 
							
								<head>
							 | 
						||
| 
								 | 
							
								<title>Call Graph - GNU gprof</title>
							 | 
						||
| 
								 | 
							
								<meta http-equiv="Content-Type" content="text/html">
							 | 
						||
| 
								 | 
							
								<meta name="description" content="GNU gprof">
							 | 
						||
| 
								 | 
							
								<meta name="generator" content="makeinfo 4.7">
							 | 
						||
| 
								 | 
							
								<link title="Top" rel="start" href="index.html#Top">
							 | 
						||
| 
								 | 
							
								<link rel="up" href="Output.html#Output" title="Output">
							 | 
						||
| 
								 | 
							
								<link rel="prev" href="Flat-Profile.html#Flat-Profile" title="Flat Profile">
							 | 
						||
| 
								 | 
							
								<link rel="next" href="Line_002dby_002dline.html#Line_002dby_002dline" title="Line-by-line">
							 | 
						||
| 
								 | 
							
								<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
							 | 
						||
| 
								 | 
							
								<!--
							 | 
						||
| 
								 | 
							
								This file documents the gprof profiler of the GNU system.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Copyright (C) 1988, 92, 97, 98, 99, 2000, 2001, 2003, 2007 Free Software Foundation, Inc.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Permission is granted to copy, distribute and/or modify this document
							 | 
						||
| 
								 | 
							
								under the terms of the GNU Free Documentation License, Version 1.1
							 | 
						||
| 
								 | 
							
								or any later version published by the Free Software Foundation;
							 | 
						||
| 
								 | 
							
								with no Invariant Sections, with no Front-Cover Texts, and with no
							 | 
						||
| 
								 | 
							
								Back-Cover Texts.  A copy of the license is included in the
							 | 
						||
| 
								 | 
							
								section entitled ``GNU Free Documentation License''.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								man end-->
							 | 
						||
| 
								 | 
							
								<meta http-equiv="Content-Style-Type" content="text/css">
							 | 
						||
| 
								 | 
							
								<style type="text/css"><!--
							 | 
						||
| 
								 | 
							
								  pre.display { font-family:inherit }
							 | 
						||
| 
								 | 
							
								  pre.format  { font-family:inherit }
							 | 
						||
| 
								 | 
							
								  pre.smalldisplay { font-family:inherit; font-size:smaller }
							 | 
						||
| 
								 | 
							
								  pre.smallformat  { font-family:inherit; font-size:smaller }
							 | 
						||
| 
								 | 
							
								  pre.smallexample { font-size:smaller }
							 | 
						||
| 
								 | 
							
								  pre.smalllisp    { font-size:smaller }
							 | 
						||
| 
								 | 
							
								  span.sc { font-variant:small-caps }
							 | 
						||
| 
								 | 
							
								  span.roman { font-family: serif; font-weight: normal; } 
							 | 
						||
| 
								 | 
							
								--></style>
							 | 
						||
| 
								 | 
							
								</head>
							 | 
						||
| 
								 | 
							
								<body>
							 | 
						||
| 
								 | 
							
								<div class="node">
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								<a name="Call-Graph"></a>Next: <a rel="next" accesskey="n" href="Line_002dby_002dline.html#Line_002dby_002dline">Line-by-line</a>,
							 | 
						||
| 
								 | 
							
								Previous: <a rel="previous" accesskey="p" href="Flat-Profile.html#Flat-Profile">Flat Profile</a>,
							 | 
						||
| 
								 | 
							
								Up: <a rel="up" accesskey="u" href="Output.html#Output">Output</a>
							 | 
						||
| 
								 | 
							
								<hr><br>
							 | 
						||
| 
								 | 
							
								</div>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<h3 class="section">5.2 The Call Graph</h3>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p><a name="index-call-graph-2"></a>
							 | 
						||
| 
								 | 
							
								The <dfn>call graph</dfn> shows how much time was spent in each function
							 | 
						||
| 
								 | 
							
								and its children.  From this information, you can find functions that,
							 | 
						||
| 
								 | 
							
								while they themselves may not have used much time, called other
							 | 
						||
| 
								 | 
							
								functions that did use unusual amounts of time.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p>Here is a sample call from a small program.  This call came from the
							 | 
						||
| 
								 | 
							
								same <code>gprof</code> run as the flat profile example in the previous
							 | 
						||
| 
								 | 
							
								section.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<pre class="smallexample">     granularity: each sample hit covers 2 byte(s) for 20.00% of 0.05 seconds
							 | 
						||
| 
								 | 
							
								     
							 | 
						||
| 
								 | 
							
								     index % time    self  children    called     name
							 | 
						||
| 
								 | 
							
								                                                      <spontaneous>
							 | 
						||
| 
								 | 
							
								     [1]    100.0    0.00    0.05                 start [1]
							 | 
						||
| 
								 | 
							
								                     0.00    0.05       1/1           main [2]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       1/2           on_exit [28]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       1/1           exit [59]
							 | 
						||
| 
								 | 
							
								     -----------------------------------------------
							 | 
						||
| 
								 | 
							
								                     0.00    0.05       1/1           start [1]
							 | 
						||
| 
								 | 
							
								     [2]    100.0    0.00    0.05       1         main [2]
							 | 
						||
| 
								 | 
							
								                     0.00    0.05       1/1           report [3]
							 | 
						||
| 
								 | 
							
								     -----------------------------------------------
							 | 
						||
| 
								 | 
							
								                     0.00    0.05       1/1           main [2]
							 | 
						||
| 
								 | 
							
								     [3]    100.0    0.00    0.05       1         report [3]
							 | 
						||
| 
								 | 
							
								                     0.00    0.03       8/8           timelocal [6]
							 | 
						||
| 
								 | 
							
								                     0.00    0.01       1/1           print [9]
							 | 
						||
| 
								 | 
							
								                     0.00    0.01       9/9           fgets [12]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00      12/34          strncmp <cycle 1> [40]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       8/8           lookup [20]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       1/1           fopen [21]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       8/8           chewtime [24]
							 | 
						||
| 
								 | 
							
								                     0.00    0.00       8/16          skipspace [44]
							 | 
						||
| 
								 | 
							
								     -----------------------------------------------
							 | 
						||
| 
								 | 
							
								     [4]     59.8    0.01        0.02       8+472     <cycle 2 as a whole> [4]
							 | 
						||
| 
								 | 
							
								                     0.01        0.02     244+260         offtime <cycle 2> [7]
							 | 
						||
| 
								 | 
							
								                     0.00        0.00     236+1           tzset <cycle 2> [26]
							 | 
						||
| 
								 | 
							
								     -----------------------------------------------
							 | 
						||
| 
								 | 
							
								</pre>
							 | 
						||
| 
								 | 
							
								   <p>The lines full of dashes divide this table into <dfn>entries</dfn>, one for each
							 | 
						||
| 
								 | 
							
								function.  Each entry has one or more lines.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p>In each entry, the primary line is the one that starts with an index number
							 | 
						||
| 
								 | 
							
								in square brackets.  The end of this line says which function the entry is
							 | 
						||
| 
								 | 
							
								for.  The preceding lines in the entry describe the callers of this
							 | 
						||
| 
								 | 
							
								function and the following lines describe its subroutines (also called
							 | 
						||
| 
								 | 
							
								<dfn>children</dfn> when we speak of the call graph).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p>The entries are sorted by time spent in the function and its subroutines.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p>The internal profiling function <code>mcount</code> (see <a href="Flat-Profile.html#Flat-Profile">The Flat Profile</a>) is never mentioned in the call graph.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<ul class="menu">
							 | 
						||
| 
								 | 
							
								<li><a accesskey="1" href="Primary.html#Primary">Primary</a>:        Details of the primary line's contents. 
							 | 
						||
| 
								 | 
							
								<li><a accesskey="2" href="Callers.html#Callers">Callers</a>:        Details of caller-lines' contents. 
							 | 
						||
| 
								 | 
							
								<li><a accesskey="3" href="Subroutines.html#Subroutines">Subroutines</a>:    Details of subroutine-lines' contents. 
							 | 
						||
| 
								 | 
							
								<li><a accesskey="4" href="Cycles.html#Cycles">Cycles</a>:         When there are cycles of recursion,
							 | 
						||
| 
								 | 
							
								                   such as <code>a</code> calls <code>b</code> calls <code>a</code>... 
							 | 
						||
| 
								 | 
							
								</ul>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   </body></html>
							 | 
						||
| 
								 | 
							
								
							 |