5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.DebugClients.Python.PyProfile</h1> |
9 <h1>eric7.DebugClients.Python.PyProfile</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module defining additions to the standard Python profile.py. |
11 Module defining additions to the standard Python profile.py. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
15 <table> |
16 <table> |
16 <tr><td>None</td></tr> |
17 <tr><td>None</td></tr> |
17 </table> |
18 </table> |
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
20 <table> |
21 <table> |
|
22 |
|
23 <tr> |
21 <tr> |
24 <td><a href="#PyProfile">PyProfile</a></td> |
22 <td><a href="#PyProfile">PyProfile</a></td> |
25 <td>Class extending the standard Python profiler with additional methods.</td> |
23 <td>Class extending the standard Python profiler with additional methods.</td> |
26 </tr> |
24 </tr> |
27 </table> |
25 </table> |
|
26 |
28 <h3>Functions</h3> |
27 <h3>Functions</h3> |
29 |
28 <table> |
30 <table> |
29 <tr><td>None</td></tr> |
31 <tr><td>None</td></tr> |
30 </table> |
32 </table> |
31 |
33 <hr /> |
32 <hr /> |
34 <hr /> |
33 <hr /> |
35 <a NAME="PyProfile" ID="PyProfile"></a> |
34 <a NAME="PyProfile" ID="PyProfile"></a> |
36 <h2>PyProfile</h2> |
35 <h2>PyProfile</h2> |
37 |
|
38 <p> |
36 <p> |
39 Class extending the standard Python profiler with additional methods. |
37 Class extending the standard Python profiler with additional methods. |
40 </p> |
38 </p> |
41 <p> |
39 <p> |
42 This class extends the standard Python profiler by the functionality to |
40 This class extends the standard Python profiler by the functionality to |
43 save the collected timing data in a timing cache, to restore these data |
41 save the collected timing data in a timing cache, to restore these data |
44 on subsequent calls, to store a profile dump to a standard filename and |
42 on subsequent calls, to store a profile dump to a standard filename and |
45 to erase these caches. |
43 to erase these caches. |
46 </p> |
44 </p> |
|
45 |
47 <h3>Derived from</h3> |
46 <h3>Derived from</h3> |
48 profile.Profile |
47 profile.Profile |
49 <h3>Class Attributes</h3> |
48 <h3>Class Attributes</h3> |
50 |
|
51 <table> |
49 <table> |
52 <tr><td>dispatch</td></tr> |
50 <tr><td>dispatch</td></tr> |
53 </table> |
51 </table> |
|
52 |
54 <h3>Class Methods</h3> |
53 <h3>Class Methods</h3> |
55 |
54 <table> |
56 <table> |
55 <tr><td>None</td></tr> |
57 <tr><td>None</td></tr> |
56 </table> |
58 </table> |
57 |
59 <h3>Methods</h3> |
58 <h3>Methods</h3> |
60 |
59 <table> |
61 <table> |
|
62 |
|
63 <tr> |
60 <tr> |
64 <td><a href="#PyProfile.__init__">PyProfile</a></td> |
61 <td><a href="#PyProfile.__init__">PyProfile</a></td> |
65 <td>Constructor</td> |
62 <td>Constructor</td> |
66 </tr> |
63 </tr> |
67 <tr> |
64 <tr> |
87 <tr> |
84 <tr> |
88 <td><a href="#PyProfile.trace_dispatch_call">trace_dispatch_call</a></td> |
85 <td><a href="#PyProfile.trace_dispatch_call">trace_dispatch_call</a></td> |
89 <td>Public method used to trace functions calls.</td> |
86 <td>Public method used to trace functions calls.</td> |
90 </tr> |
87 </tr> |
91 </table> |
88 </table> |
|
89 |
92 <h3>Static Methods</h3> |
90 <h3>Static Methods</h3> |
93 |
91 <table> |
94 <table> |
92 <tr><td>None</td></tr> |
95 <tr><td>None</td></tr> |
93 </table> |
96 </table> |
94 |
97 |
95 |
98 <a NAME="PyProfile.__init__" ID="PyProfile.__init__"></a> |
96 <a NAME="PyProfile.__init__" ID="PyProfile.__init__"></a> |
99 <h4>PyProfile (Constructor)</h4> |
97 <h4>PyProfile (Constructor)</h4> |
100 <b>PyProfile</b>(<i>basename, timer=None, bias=None</i>) |
98 <b>PyProfile</b>(<i>basename, timer=None, bias=None</i>) |
101 |
|
102 <p> |
99 <p> |
103 Constructor |
100 Constructor |
104 </p> |
101 </p> |
|
102 |
105 <dl> |
103 <dl> |
106 |
104 |
107 <dt><i>basename</i> (str)</dt> |
105 <dt><i>basename</i> (str)</dt> |
108 <dd> |
106 <dd> |
109 name of the script to be profiled |
107 name of the script to be profiled |
118 </dd> |
116 </dd> |
119 </dl> |
117 </dl> |
120 <a NAME="PyProfile.__restore" ID="PyProfile.__restore"></a> |
118 <a NAME="PyProfile.__restore" ID="PyProfile.__restore"></a> |
121 <h4>PyProfile.__restore</h4> |
119 <h4>PyProfile.__restore</h4> |
122 <b>__restore</b>(<i></i>) |
120 <b>__restore</b>(<i></i>) |
123 |
|
124 <p> |
121 <p> |
125 Private method to restore the timing data from the timing cache. |
122 Private method to restore the timing data from the timing cache. |
126 </p> |
123 </p> |
|
124 |
127 <a NAME="PyProfile.dump_stats" ID="PyProfile.dump_stats"></a> |
125 <a NAME="PyProfile.dump_stats" ID="PyProfile.dump_stats"></a> |
128 <h4>PyProfile.dump_stats</h4> |
126 <h4>PyProfile.dump_stats</h4> |
129 <b>dump_stats</b>(<i>file</i>) |
127 <b>dump_stats</b>(<i>file</i>) |
130 |
|
131 <p> |
128 <p> |
132 Public method to dump the statistics data. |
129 Public method to dump the statistics data. |
133 </p> |
130 </p> |
|
131 |
134 <dl> |
132 <dl> |
135 |
133 |
136 <dt><i>file</i> (str)</dt> |
134 <dt><i>file</i> (str)</dt> |
137 <dd> |
135 <dd> |
138 name of the file to write to |
136 name of the file to write to |
139 </dd> |
137 </dd> |
140 </dl> |
138 </dl> |
141 <a NAME="PyProfile.erase" ID="PyProfile.erase"></a> |
139 <a NAME="PyProfile.erase" ID="PyProfile.erase"></a> |
142 <h4>PyProfile.erase</h4> |
140 <h4>PyProfile.erase</h4> |
143 <b>erase</b>(<i></i>) |
141 <b>erase</b>(<i></i>) |
144 |
|
145 <p> |
142 <p> |
146 Public method to erase the collected timing data. |
143 Public method to erase the collected timing data. |
147 </p> |
144 </p> |
|
145 |
148 <a NAME="PyProfile.fix_frame_filename" ID="PyProfile.fix_frame_filename"></a> |
146 <a NAME="PyProfile.fix_frame_filename" ID="PyProfile.fix_frame_filename"></a> |
149 <h4>PyProfile.fix_frame_filename</h4> |
147 <h4>PyProfile.fix_frame_filename</h4> |
150 <b>fix_frame_filename</b>(<i>frame</i>) |
148 <b>fix_frame_filename</b>(<i>frame</i>) |
151 |
|
152 <p> |
149 <p> |
153 Public method used to fix up the filename for a given frame. |
150 Public method used to fix up the filename for a given frame. |
154 </p> |
151 </p> |
155 <p> |
152 <p> |
156 The logic employed here is that if a module was loaded |
153 The logic employed here is that if a module was loaded |
162 pyc is generated. If files are moved from machine to machine |
159 pyc is generated. If files are moved from machine to machine |
163 this can break debugging as the .pyc will refer to the .py |
160 this can break debugging as the .pyc will refer to the .py |
164 on the original machine. Another case might be sharing |
161 on the original machine. Another case might be sharing |
165 code over a network... This logic deals with that. |
162 code over a network... This logic deals with that. |
166 </p> |
163 </p> |
|
164 |
167 <dl> |
165 <dl> |
168 |
166 |
169 <dt><i>frame</i> (frame)</dt> |
167 <dt><i>frame</i> (frame)</dt> |
170 <dd> |
168 <dd> |
171 frame object |
169 frame object |
184 </dd> |
182 </dd> |
185 </dl> |
183 </dl> |
186 <a NAME="PyProfile.save" ID="PyProfile.save"></a> |
184 <a NAME="PyProfile.save" ID="PyProfile.save"></a> |
187 <h4>PyProfile.save</h4> |
185 <h4>PyProfile.save</h4> |
188 <b>save</b>(<i></i>) |
186 <b>save</b>(<i></i>) |
189 |
|
190 <p> |
187 <p> |
191 Public method to store the collected profile data. |
188 Public method to store the collected profile data. |
192 </p> |
189 </p> |
|
190 |
193 <a NAME="PyProfile.trace_dispatch_call" ID="PyProfile.trace_dispatch_call"></a> |
191 <a NAME="PyProfile.trace_dispatch_call" ID="PyProfile.trace_dispatch_call"></a> |
194 <h4>PyProfile.trace_dispatch_call</h4> |
192 <h4>PyProfile.trace_dispatch_call</h4> |
195 <b>trace_dispatch_call</b>(<i>frame, t</i>) |
193 <b>trace_dispatch_call</b>(<i>frame, t</i>) |
196 |
|
197 <p> |
194 <p> |
198 Public method used to trace functions calls. |
195 Public method used to trace functions calls. |
199 </p> |
196 </p> |
200 <p> |
197 <p> |
201 This is a variant of the one found in the standard Python |
198 This is a variant of the one found in the standard Python |
202 profile.py calling fix_frame_filename above. |
199 profile.py calling fix_frame_filename above. |
203 </p> |
200 </p> |
|
201 |
204 <dl> |
202 <dl> |
205 |
203 |
206 <dt><i>frame</i> (frame)</dt> |
204 <dt><i>frame</i> (frame)</dt> |
207 <dd> |
205 <dd> |
208 reference to the call frame |
206 reference to the call frame |