Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-profile.html" /> | |
13 | <link rel="prev" href="profile-instant.html" /> | |
14 | <link rel="parent" href="profile.html" /> | |
15 | <link rel="next" href="module-profile.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>10.4 What Is Deterministic Profiling?</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="10.3 Instant Users Manual" | |
25 | href="profile-instant.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="10. The Python Profiler" | |
28 | href="profile.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="10.5 Reference Manual" | |
31 | href="module-profile.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="profile-instant.html">10.3 Instant Users Manual</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="profile.html">10. The Python Profiler</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-profile.html">10.5 Reference Manual</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0012400000000000000000"> | |
56 | 10.4 What Is Deterministic Profiling?</A> | |
57 | </H1> | |
58 | <A NAME="Deterministic_Profiling"></A> | |
59 | <P> | |
60 | <i class="dfn">Deterministic profiling</i> is meant to reflect the fact that all | |
61 | <em>function call</em>, <em>function return</em>, and <em>exception</em> events | |
62 | are monitored, and precise timings are made for the intervals between | |
63 | these events (during which time the user's code is executing). In | |
64 | contrast, <i class="dfn">statistical profiling</i> (which is not done by this | |
65 | module) randomly samples the effective instruction pointer, and | |
66 | deduces where time is being spent. The latter technique traditionally | |
67 | involves less overhead (as the code does not need to be instrumented), | |
68 | but provides only relative indications of where time is being spent. | |
69 | ||
70 | <P> | |
71 | In Python, since there is an interpreter active during execution, the | |
72 | presence of instrumented code is not required to do deterministic | |
73 | profiling. Python automatically provides a <i class="dfn">hook</i> (optional | |
74 | callback) for each event. In addition, the interpreted nature of | |
75 | Python tends to add so much overhead to execution, that deterministic | |
76 | profiling tends to only add small processing overhead in typical | |
77 | applications. The result is that deterministic profiling is not that | |
78 | expensive, yet provides extensive run time statistics about the | |
79 | execution of a Python program. | |
80 | ||
81 | <P> | |
82 | Call count statistics can be used to identify bugs in code (surprising | |
83 | counts), and to identify possible inline-expansion points (high call | |
84 | counts). Internal time statistics can be used to identify ``hot | |
85 | loops'' that should be carefully optimized. Cumulative time | |
86 | statistics should be used to identify high level errors in the | |
87 | selection of algorithms. Note that the unusual handling of cumulative | |
88 | times in this profiler allows statistics for recursive implementations | |
89 | of algorithms to be directly compared to iterative implementations. | |
90 | ||
91 | <P> | |
92 | ||
93 | <DIV CLASS="navigation"> | |
94 | <div class='online-navigation'> | |
95 | <p></p><hr /> | |
96 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
97 | <tr> | |
98 | <td class='online-navigation'><a rel="prev" title="10.3 Instant Users Manual" | |
99 | href="profile-instant.html"><img src='../icons/previous.png' | |
100 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
101 | <td class='online-navigation'><a rel="parent" title="10. The Python Profiler" | |
102 | href="profile.html"><img src='../icons/up.png' | |
103 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
104 | <td class='online-navigation'><a rel="next" title="10.5 Reference Manual" | |
105 | href="module-profile.html"><img src='../icons/next.png' | |
106 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
107 | <td align="center" width="100%">Python Library Reference</td> | |
108 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
109 | href="contents.html"><img src='../icons/contents.png' | |
110 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
111 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
112 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
113 | <td class='online-navigation'><a rel="index" title="Index" | |
114 | href="genindex.html"><img src='../icons/index.png' | |
115 | border='0' height='32' alt='Index' width='32' /></A></td> | |
116 | </tr></table> | |
117 | <div class='online-navigation'> | |
118 | <b class="navlabel">Previous:</b> | |
119 | <a class="sectref" rel="prev" href="profile-instant.html">10.3 Instant Users Manual</A> | |
120 | <b class="navlabel">Up:</b> | |
121 | <a class="sectref" rel="parent" href="profile.html">10. The Python Profiler</A> | |
122 | <b class="navlabel">Next:</b> | |
123 | <a class="sectref" rel="next" href="module-profile.html">10.5 Reference Manual</A> | |
124 | </div> | |
125 | </div> | |
126 | <hr /> | |
127 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
128 | </DIV> | |
129 | <!--End of Navigation Panel--> | |
130 | <ADDRESS> | |
131 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
132 | </ADDRESS> | |
133 | </BODY> | |
134 | </HTML> |