您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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>Assumptions (GNU gprof)</title>
  16. <meta name="description" content="Assumptions (GNU gprof)">
  17. <meta name="keywords" content="Assumptions (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="Inaccuracy.html#Inaccuracy" rel="up" title="Inaccuracy">
  24. <link href="How-do-I_003f.html#How-do-I_003f" rel="next" title="How do I?">
  25. <link href="Sampling-Error.html#Sampling-Error" rel="prev" title="Sampling Error">
  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="Assumptions"></a>
  56. <div class="header">
  57. <p>
  58. Previous: <a href="Sampling-Error.html#Sampling-Error" accesskey="p" rel="prev">Sampling Error</a>, Up: <a href="Inaccuracy.html#Inaccuracy" accesskey="u" rel="up">Inaccuracy</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  59. </div>
  60. <hr>
  61. <a name="Estimating-children-Times"></a>
  62. <h3 class="section">6.2 Estimating <code>children</code> Times</h3>
  63. <p>Some of the figures in the call graph are estimates&mdash;for example, the
  64. <code>children</code> time values and all the time figures in caller and
  65. subroutine lines.
  66. </p>
  67. <p>There is no direct information about these measurements in the profile
  68. data itself. Instead, <code>gprof</code> estimates them by making an assumption
  69. about your program that might or might not be true.
  70. </p>
  71. <p>The assumption made is that the average time spent in each call to any
  72. function <code>foo</code> is not correlated with who called <code>foo</code>. If
  73. <code>foo</code> used 5 seconds in all, and 2/5 of the calls to <code>foo</code> came
  74. from <code>a</code>, then <code>foo</code> contributes 2 seconds to <code>a</code>&rsquo;s
  75. <code>children</code> time, by assumption.
  76. </p>
  77. <p>This assumption is usually true enough, but for some programs it is far
  78. from true. Suppose that <code>foo</code> returns very quickly when its argument
  79. is zero; suppose that <code>a</code> always passes zero as an argument, while
  80. other callers of <code>foo</code> pass other arguments. In this program, all the
  81. time spent in <code>foo</code> is in the calls from callers other than <code>a</code>.
  82. But <code>gprof</code> has no way of knowing this; it will blindly and
  83. incorrectly charge 2 seconds of time in <code>foo</code> to the children of
  84. <code>a</code>.
  85. </p>
  86. <p>We hope some day to put more complete data into <samp>gmon.out</samp>, so that
  87. this assumption is no longer needed, if we can figure out how. For the
  88. novice, the estimated figures are usually more useful than misleading.
  89. </p>
  90. </body>
  91. </html>