You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 satır
7.1KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the gprof profiler of the GNU system.
  4. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Call Graph (GNU gprof)</title>
  16. <meta name="description" content="Call Graph (GNU gprof)">
  17. <meta name="keywords" content="Call Graph (GNU gprof)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="Output.html#Output" rel="up" title="Output">
  24. <link href="Primary.html#Primary" rel="next" title="Primary">
  25. <link href="Flat-Profile.html#Flat-Profile" rel="prev" title="Flat Profile">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.indentedblock {margin-right: 0em}
  30. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style: oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nolinebreak {white-space: nowrap}
  48. span.roman {font-family: initial; font-weight: normal}
  49. span.sansserif {font-family: sans-serif; font-weight: normal}
  50. ul.no-bullet {list-style: none}
  51. -->
  52. </style>
  53. </head>
  54. <body lang="en">
  55. <a name="Call-Graph"></a>
  56. <div class="header">
  57. <p>
  58. Next: <a href="Line_002dby_002dline.html#Line_002dby_002dline" accesskey="n" rel="next">Line-by-line</a>, Previous: <a href="Flat-Profile.html#Flat-Profile" accesskey="p" rel="prev">Flat Profile</a>, Up: <a href="Output.html#Output" accesskey="u" rel="up">Output</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  59. </div>
  60. <hr>
  61. <a name="The-Call-Graph"></a>
  62. <h3 class="section">5.2 The Call Graph</h3>
  63. <a name="index-call-graph"></a>
  64. <p>The <em>call graph</em> shows how much time was spent in each function
  65. and its children. From this information, you can find functions that,
  66. while they themselves may not have used much time, called other
  67. functions that did use unusual amounts of time.
  68. </p>
  69. <p>Here is a sample call from a small program. This call came from the
  70. same <code>gprof</code> run as the flat profile example in the previous
  71. section.
  72. </p>
  73. <div class="smallexample">
  74. <pre class="smallexample">granularity: each sample hit covers 2 byte(s) for 20.00% of 0.05 seconds
  75. index % time self children called name
  76. &lt;spontaneous&gt;
  77. [1] 100.0 0.00 0.05 start [1]
  78. 0.00 0.05 1/1 main [2]
  79. 0.00 0.00 1/2 on_exit [28]
  80. 0.00 0.00 1/1 exit [59]
  81. -----------------------------------------------
  82. 0.00 0.05 1/1 start [1]
  83. [2] 100.0 0.00 0.05 1 main [2]
  84. 0.00 0.05 1/1 report [3]
  85. -----------------------------------------------
  86. 0.00 0.05 1/1 main [2]
  87. [3] 100.0 0.00 0.05 1 report [3]
  88. 0.00 0.03 8/8 timelocal [6]
  89. 0.00 0.01 1/1 print [9]
  90. 0.00 0.01 9/9 fgets [12]
  91. 0.00 0.00 12/34 strncmp &lt;cycle 1&gt; [40]
  92. 0.00 0.00 8/8 lookup [20]
  93. 0.00 0.00 1/1 fopen [21]
  94. 0.00 0.00 8/8 chewtime [24]
  95. 0.00 0.00 8/16 skipspace [44]
  96. -----------------------------------------------
  97. [4] 59.8 0.01 0.02 8+472 &lt;cycle 2 as a whole&gt; [4]
  98. 0.01 0.02 244+260 offtime &lt;cycle 2&gt; [7]
  99. 0.00 0.00 236+1 tzset &lt;cycle 2&gt; [26]
  100. -----------------------------------------------
  101. </pre></div>
  102. <p>The lines full of dashes divide this table into <em>entries</em>, one for each
  103. function. Each entry has one or more lines.
  104. </p>
  105. <p>In each entry, the primary line is the one that starts with an index number
  106. in square brackets. The end of this line says which function the entry is
  107. for. The preceding lines in the entry describe the callers of this
  108. function and the following lines describe its subroutines (also called
  109. <em>children</em> when we speak of the call graph).
  110. </p>
  111. <p>The entries are sorted by time spent in the function and its subroutines.
  112. </p>
  113. <p>The internal profiling function <code>mcount</code> (see <a href="Flat-Profile.html#Flat-Profile">The
  114. Flat Profile</a>) is never mentioned in the call graph.
  115. </p>
  116. <table class="menu" border="0" cellspacing="0">
  117. <tr><td align="left" valign="top">&bull; <a href="Primary.html#Primary" accesskey="1">Primary</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Details of the primary line&rsquo;s contents.
  118. </td></tr>
  119. <tr><td align="left" valign="top">&bull; <a href="Callers.html#Callers" accesskey="2">Callers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Details of caller-lines&rsquo; contents.
  120. </td></tr>
  121. <tr><td align="left" valign="top">&bull; <a href="Subroutines.html#Subroutines" accesskey="3">Subroutines</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Details of subroutine-lines&rsquo; contents.
  122. </td></tr>
  123. <tr><td align="left" valign="top">&bull; <a href="Cycles.html#Cycles" accesskey="4">Cycles</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">When there are cycles of recursion,
  124. such as <code>a</code> calls <code>b</code> calls <code>a</code>&hellip;
  125. </td></tr>
  126. </table>
  127. <hr>
  128. <div class="header">
  129. <p>
  130. Next: <a href="Line_002dby_002dline.html#Line_002dby_002dline" accesskey="n" rel="next">Line-by-line</a>, Previous: <a href="Flat-Profile.html#Flat-Profile" accesskey="p" rel="prev">Flat Profile</a>, Up: <a href="Output.html#Output" accesskey="u" rel="up">Output</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  131. </div>
  132. </body>
  133. </html>