Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

181 lines
11KB

  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>Top (GNU gprof)</title>
  16. <meta name="description" content="Top (GNU gprof)">
  17. <meta name="keywords" content="Top (GNU gprof)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="#Top" rel="start" title="Top">
  22. <link href="#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="../dir/index.html" rel="up" title="(dir)">
  24. <link href="Introduction.html#Introduction" rel="next" title="Introduction">
  25. <style type="text/css">
  26. <!--
  27. a.summary-letter {text-decoration: none}
  28. blockquote.indentedblock {margin-right: 0em}
  29. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {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.smalllisp {margin-left: 3.2em}
  37. kbd {font-style: oblique}
  38. pre.display {font-family: inherit}
  39. pre.format {font-family: inherit}
  40. pre.menu-comment {font-family: serif}
  41. pre.menu-preformatted {font-family: serif}
  42. pre.smalldisplay {font-family: inherit; font-size: smaller}
  43. pre.smallexample {font-size: smaller}
  44. pre.smallformat {font-family: inherit; font-size: smaller}
  45. pre.smalllisp {font-size: smaller}
  46. span.nolinebreak {white-space: nowrap}
  47. span.roman {font-family: initial; font-weight: normal}
  48. span.sansserif {font-family: sans-serif; font-weight: normal}
  49. ul.no-bullet {list-style: none}
  50. -->
  51. </style>
  52. </head>
  53. <body lang="en">
  54. <h1 class="settitle" align="center">GNU gprof</h1>
  55. <a name="SEC_Contents"></a>
  56. <h2 class="contents-heading">Table of Contents</h2>
  57. <div class="contents">
  58. <ul class="no-bullet">
  59. <li><a name="toc-Introduction-to-Profiling" href="Introduction.html#Introduction">1 Introduction to Profiling</a></li>
  60. <li><a name="toc-Compiling-a-Program-for-Profiling" href="Compiling.html#Compiling">2 Compiling a Program for Profiling</a></li>
  61. <li><a name="toc-Executing-the-Program" href="Executing.html#Executing">3 Executing the Program</a></li>
  62. <li><a name="toc-gprof-Command-Summary" href="Invoking.html#Invoking">4 <code>gprof</code> Command Summary</a>
  63. <ul class="no-bullet">
  64. <li><a name="toc-Output-Options-1" href="Output-Options.html#Output-Options">4.1 Output Options</a></li>
  65. <li><a name="toc-Analysis-Options-1" href="Analysis-Options.html#Analysis-Options">4.2 Analysis Options</a></li>
  66. <li><a name="toc-Miscellaneous-Options-1" href="Miscellaneous-Options.html#Miscellaneous-Options">4.3 Miscellaneous Options</a></li>
  67. <li><a name="toc-Deprecated-Options-1" href="Deprecated-Options.html#Deprecated-Options">4.4 Deprecated Options</a></li>
  68. <li><a name="toc-Symspecs-1" href="Symspecs.html#Symspecs">4.5 Symspecs</a></li>
  69. </ul></li>
  70. <li><a name="toc-Interpreting-gprof_0027s-Output" href="Output.html#Output">5 Interpreting <code>gprof</code>&rsquo;s Output</a>
  71. <ul class="no-bullet">
  72. <li><a name="toc-The-Flat-Profile" href="Flat-Profile.html#Flat-Profile">5.1 The Flat Profile</a></li>
  73. <li><a name="toc-The-Call-Graph" href="Call-Graph.html#Call-Graph">5.2 The Call Graph</a>
  74. <ul class="no-bullet">
  75. <li><a name="toc-The-Primary-Line" href="Primary.html#Primary">5.2.1 The Primary Line</a></li>
  76. <li><a name="toc-Lines-for-a-Function_0027s-Callers" href="Callers.html#Callers">5.2.2 Lines for a Function&rsquo;s Callers</a></li>
  77. <li><a name="toc-Lines-for-a-Function_0027s-Subroutines" href="Subroutines.html#Subroutines">5.2.3 Lines for a Function&rsquo;s Subroutines</a></li>
  78. <li><a name="toc-How-Mutually-Recursive-Functions-Are-Described" href="Cycles.html#Cycles">5.2.4 How Mutually Recursive Functions Are Described</a></li>
  79. </ul></li>
  80. <li><a name="toc-Line_002dby_002dline-Profiling" href="Line_002dby_002dline.html#Line_002dby_002dline">5.3 Line-by-line Profiling</a></li>
  81. <li><a name="toc-The-Annotated-Source-Listing" href="Annotated-Source.html#Annotated-Source">5.4 The Annotated Source Listing</a></li>
  82. </ul></li>
  83. <li><a name="toc-Inaccuracy-of-gprof-Output" href="Inaccuracy.html#Inaccuracy">6 Inaccuracy of <code>gprof</code> Output</a>
  84. <ul class="no-bullet">
  85. <li><a name="toc-Statistical-Sampling-Error" href="Sampling-Error.html#Sampling-Error">6.1 Statistical Sampling Error</a></li>
  86. <li><a name="toc-Estimating-children-Times" href="Assumptions.html#Assumptions">6.2 Estimating <code>children</code> Times</a></li>
  87. </ul></li>
  88. <li><a name="toc-Answers-to-Common-Questions" href="How-do-I_003f.html#How-do-I_003f">7 Answers to Common Questions</a></li>
  89. <li><a name="toc-Incompatibilities-with-Unix-gprof" href="Incompatibilities.html#Incompatibilities">8 Incompatibilities with Unix <code>gprof</code></a></li>
  90. <li><a name="toc-Details-of-Profiling" href="Details.html#Details">9 Details of Profiling</a>
  91. <ul class="no-bullet">
  92. <li><a name="toc-Implementation-of-Profiling" href="Implementation.html#Implementation">9.1 Implementation of Profiling</a></li>
  93. <li><a name="toc-Profiling-Data-File-Format" href="File-Format.html#File-Format">9.2 Profiling Data File Format</a>
  94. <ul class="no-bullet">
  95. <li><a name="toc-Histogram-Records" href="File-Format.html#Histogram-Records">9.2.1 Histogram Records</a></li>
  96. <li><a name="toc-Call_002dGraph-Records" href="File-Format.html#Call_002dGraph-Records">9.2.2 Call-Graph Records</a></li>
  97. <li><a name="toc-Basic_002dBlock-Execution-Count-Records" href="File-Format.html#Basic_002dBlock-Execution-Count-Records">9.2.3 Basic-Block Execution Count Records</a></li>
  98. </ul></li>
  99. <li><a name="toc-gprof_0027s-Internal-Operation" href="Internals.html#Internals">9.3 <code>gprof</code>&rsquo;s Internal Operation</a></li>
  100. <li><a name="toc-Debugging-gprof" href="Debugging.html#Debugging">9.4 Debugging <code>gprof</code></a></li>
  101. </ul></li>
  102. <li><a name="toc-GNU-Free-Documentation-License-1" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">Appendix A GNU Free Documentation License</a></li>
  103. </ul>
  104. </div>
  105. <a name="Top"></a>
  106. <div class="header">
  107. <p>
  108. Next: <a href="Introduction.html#Introduction" accesskey="n" rel="next">Introduction</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  109. </div>
  110. <hr>
  111. <a name="Profiling-a-Program_003a-Where-Does-It-Spend-Its-Time_003f"></a>
  112. <h1 class="top">Profiling a Program: Where Does It Spend Its Time?</h1>
  113. <p>This manual describes the <small>GNU</small> profiler, <code>gprof</code>, and how you
  114. can use it to determine which parts of a program are taking most of the
  115. execution time. We assume that you know how to write, compile, and
  116. execute programs. <small>GNU</small> <code>gprof</code> was written by Jay Fenlason.
  117. </p>
  118. <p>This manual is for <code>gprof</code>
  119. (GNU Arm Embedded Toolchain 10-2020-q4-major)
  120. version 2.35.1.
  121. </p>
  122. <p>This document is distributed under the terms of the GNU Free
  123. Documentation License version 1.3. A copy of the license is included
  124. in the section entitled &ldquo;GNU Free Documentation License&rdquo;.
  125. </p>
  126. <table class="menu" border="0" cellspacing="0">
  127. <tr><td align="left" valign="top">&bull; <a href="Introduction.html#Introduction" accesskey="1">Introduction</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">What profiling means, and why it is useful.
  128. </td></tr>
  129. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  130. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="Compiling.html#Compiling" accesskey="2">Compiling</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to compile your program for profiling.
  131. </td></tr>
  132. <tr><td align="left" valign="top">&bull; <a href="Executing.html#Executing" accesskey="3">Executing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Executing your program to generate profile data
  133. </td></tr>
  134. <tr><td align="left" valign="top">&bull; <a href="Invoking.html#Invoking" accesskey="4">Invoking</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to run <code>gprof</code>, and its options
  135. </td></tr>
  136. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  137. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="Output.html#Output" accesskey="5">Output</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Interpreting <code>gprof</code>&rsquo;s output
  138. </td></tr>
  139. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  140. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="Inaccuracy.html#Inaccuracy" accesskey="6">Inaccuracy</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Potential problems you should be aware of
  141. </td></tr>
  142. <tr><td align="left" valign="top">&bull; <a href="How-do-I_003f.html#How-do-I_003f" accesskey="7">How do I?</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Answers to common questions
  143. </td></tr>
  144. <tr><td align="left" valign="top">&bull; <a href="Incompatibilities.html#Incompatibilities" accesskey="8">Incompatibilities</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">(between <small>GNU</small> <code>gprof</code> and Unix <code>gprof</code>.)
  145. </td></tr>
  146. <tr><td align="left" valign="top">&bull; <a href="Details.html#Details" accesskey="9">Details</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Details of how profiling is done
  147. </td></tr>
  148. <tr><td align="left" valign="top">&bull; <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">GNU Free Documentation License
  149. </td></tr>
  150. </table>
  151. <hr>
  152. <div class="header">
  153. <p>
  154. Next: <a href="Introduction.html#Introduction" accesskey="n" rel="next">Introduction</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  155. </div>
  156. </body>
  157. </html>