Subroutines.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>GNU gprof: Subroutines</title>
  15. <meta name="description" content="GNU gprof: Subroutines">
  16. <meta name="keywords" content="GNU gprof: Subroutines">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Call-Graph.html#Call-Graph" rel="up" title="Call Graph">
  24. <link href="Cycles.html#Cycles" rel="next" title="Cycles">
  25. <link href="Callers.html#Callers" rel="prev" title="Callers">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.smallquotation {font-size: smaller}
  30. div.display {margin-left: 3.2em}
  31. div.example {margin-left: 3.2em}
  32. div.indentedblock {margin-left: 3.2em}
  33. div.lisp {margin-left: 3.2em}
  34. div.smalldisplay {margin-left: 3.2em}
  35. div.smallexample {margin-left: 3.2em}
  36. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  48. span.nolinebreak {white-space:nowrap}
  49. span.roman {font-family:serif; font-weight:normal}
  50. span.sansserif {font-family:sans-serif; font-weight:normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  56. <a name="Subroutines"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Cycles.html#Cycles" accesskey="n" rel="next">Cycles</a>, Previous: <a href="Callers.html#Callers" accesskey="p" rel="prev">Callers</a>, Up: <a href="Call-Graph.html#Call-Graph" accesskey="u" rel="up">Call Graph</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Lines-for-a-Function_0027s-Subroutines"></a>
  63. <h4 class="subsection">5.2.3 Lines for a Function&rsquo;s Subroutines</h4>
  64. <p>A function&rsquo;s entry has a line for each of its subroutines&mdash;in other
  65. words, a line for each other function that it called. These lines&rsquo;
  66. fields correspond to the fields of the primary line, but their meanings
  67. are different because of the difference in context.
  68. </p>
  69. <p>For reference, we repeat two lines from the entry for the function
  70. <code>main</code>, the primary line and a line for a subroutine, together
  71. with the heading line that shows the names of the fields:
  72. </p>
  73. <div class="smallexample">
  74. <pre class="smallexample">index % time self children called name
  75. &hellip;
  76. [2] 100.0 0.00 0.05 1 main [2]
  77. 0.00 0.05 1/1 report [3]
  78. </pre></div>
  79. <p>Here are the meanings of the fields in the subroutine-line for <code>main</code>
  80. calling <code>report</code>:
  81. </p>
  82. <dl compact="compact">
  83. <dt><code>self</code></dt>
  84. <dd><p>An estimate of the amount of time spent directly within <code>report</code>
  85. when <code>report</code> was called from <code>main</code>.
  86. </p>
  87. </dd>
  88. <dt><code>children</code></dt>
  89. <dd><p>An estimate of the amount of time spent in subroutines of <code>report</code>
  90. when <code>report</code> was called from <code>main</code>.
  91. </p>
  92. <p>The sum of the <code>self</code> and <code>children</code> fields is an estimate
  93. of the total time spent in calls to <code>report</code> from <code>main</code>.
  94. </p>
  95. </dd>
  96. <dt><code>called</code></dt>
  97. <dd><p>Two numbers, the number of calls to <code>report</code> from <code>main</code>
  98. followed by the total number of non-recursive calls to <code>report</code>.
  99. This ratio is used to determine how much of <code>report</code>&rsquo;s <code>self</code>
  100. and <code>children</code> time gets credited to <code>main</code>.
  101. See <a href="Assumptions.html#Assumptions">Estimating <code>children</code> Times</a>.
  102. </p>
  103. </dd>
  104. <dt><code>name</code></dt>
  105. <dd><p>The name of the subroutine of <code>main</code> to which this line applies,
  106. followed by the subroutine&rsquo;s index number.
  107. </p>
  108. <p>If the caller is part of a recursion cycle, the cycle number is
  109. printed between the name and the index number.
  110. </p></dd>
  111. </dl>
  112. <hr>
  113. <div class="header">
  114. <p>
  115. Next: <a href="Cycles.html#Cycles" accesskey="n" rel="next">Cycles</a>, Previous: <a href="Callers.html#Callers" accesskey="p" rel="prev">Callers</a>, Up: <a href="Call-Graph.html#Call-Graph" accesskey="u" rel="up">Call Graph</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  116. </div>
  117. </body>
  118. </html>