src/eric7/Documentation/Source/eric7.DebugClients.Python.PyProfile.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10417
c6011e501282
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.DebugClients.Python.PyProfile</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.DebugClients.Python.PyProfile</h1>
10
11 <p>
12 Module defining additions to the standard Python profile.py.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#PyProfile">PyProfile</a></td>
25 <td>Class extending the standard Python profiler with additional methods.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="PyProfile" ID="PyProfile"></a>
36 <h2>PyProfile</h2>
37
38 <p>
39 Class extending the standard Python profiler with additional methods.
40 </p>
41 <p>
42 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
44 on subsequent calls, to store a profile dump to a standard filename and
45 to erase these caches.
46 </p>
47 <h3>Derived from</h3>
48 profile.Profile
49 <h3>Class Attributes</h3>
50
51 <table>
52 <tr><td>dispatch</td></tr>
53 </table>
54 <h3>Class Methods</h3>
55
56 <table>
57 <tr><td>None</td></tr>
58 </table>
59 <h3>Methods</h3>
60
61 <table>
62
63 <tr>
64 <td><a href="#PyProfile.__init__">PyProfile</a></td>
65 <td>Constructor</td>
66 </tr>
67 <tr>
68 <td><a href="#PyProfile.__restore">__restore</a></td>
69 <td>Private method to restore the timing data from the timing cache.</td>
70 </tr>
71 <tr>
72 <td><a href="#PyProfile.dump_stats">dump_stats</a></td>
73 <td>Public method to dump the statistics data.</td>
74 </tr>
75 <tr>
76 <td><a href="#PyProfile.erase">erase</a></td>
77 <td>Public method to erase the collected timing data.</td>
78 </tr>
79 <tr>
80 <td><a href="#PyProfile.fix_frame_filename">fix_frame_filename</a></td>
81 <td>Public method used to fixup the filename for a given frame.</td>
82 </tr>
83 <tr>
84 <td><a href="#PyProfile.save">save</a></td>
85 <td>Public method to store the collected profile data.</td>
86 </tr>
87 <tr>
88 <td><a href="#PyProfile.trace_dispatch_call">trace_dispatch_call</a></td>
89 <td>Public method used to trace functions calls.</td>
90 </tr>
91 </table>
92 <h3>Static Methods</h3>
93
94 <table>
95 <tr><td>None</td></tr>
96 </table>
97
98 <a NAME="PyProfile.__init__" ID="PyProfile.__init__"></a>
99 <h4>PyProfile (Constructor)</h4>
100 <b>PyProfile</b>(<i>basename, timer=None, bias=None</i>)
101
102 <p>
103 Constructor
104 </p>
105 <dl>
106
107 <dt><i>basename</i></dt>
108 <dd>
109 name of the script to be profiled (string)
110 </dd>
111 <dt><i>timer</i></dt>
112 <dd>
113 function defining the timing calculation
114 </dd>
115 <dt><i>bias</i></dt>
116 <dd>
117 calibration value (float)
118 </dd>
119 </dl>
120 <a NAME="PyProfile.__restore" ID="PyProfile.__restore"></a>
121 <h4>PyProfile.__restore</h4>
122 <b>__restore</b>(<i></i>)
123
124 <p>
125 Private method to restore the timing data from the timing cache.
126 </p>
127 <a NAME="PyProfile.dump_stats" ID="PyProfile.dump_stats"></a>
128 <h4>PyProfile.dump_stats</h4>
129 <b>dump_stats</b>(<i>file</i>)
130
131 <p>
132 Public method to dump the statistics data.
133 </p>
134 <dl>
135
136 <dt><i>file</i></dt>
137 <dd>
138 name of the file to write to (string)
139 </dd>
140 </dl>
141 <a NAME="PyProfile.erase" ID="PyProfile.erase"></a>
142 <h4>PyProfile.erase</h4>
143 <b>erase</b>(<i></i>)
144
145 <p>
146 Public method to erase the collected timing data.
147 </p>
148 <a NAME="PyProfile.fix_frame_filename" ID="PyProfile.fix_frame_filename"></a>
149 <h4>PyProfile.fix_frame_filename</h4>
150 <b>fix_frame_filename</b>(<i>frame</i>)
151
152 <p>
153 Public method used to fixup the filename for a given frame.
154 </p>
155 <p>
156 The logic employed here is that if a module was loaded
157 from a .pyc file, then the correct .py to operate with
158 should be in the same path as the .pyc. The reason this
159 logic is needed is that when a .pyc file is generated, the
160 filename embedded and thus what is readable in the code object
161 of the frame object is the fully qualified filepath when the
162 pyc is generated. If files are moved from machine to machine
163 this can break debugging as the .pyc will refer to the .py
164 on the original machine. Another case might be sharing
165 code over a network... This logic deals with that.
166 </p>
167 <dl>
168
169 <dt><i>frame</i></dt>
170 <dd>
171 the frame object
172 </dd>
173 </dl>
174 <dl>
175 <dt>Return:</dt>
176 <dd>
177 fixed up file name (string)
178 </dd>
179 </dl>
180 <a NAME="PyProfile.save" ID="PyProfile.save"></a>
181 <h4>PyProfile.save</h4>
182 <b>save</b>(<i></i>)
183
184 <p>
185 Public method to store the collected profile data.
186 </p>
187 <a NAME="PyProfile.trace_dispatch_call" ID="PyProfile.trace_dispatch_call"></a>
188 <h4>PyProfile.trace_dispatch_call</h4>
189 <b>trace_dispatch_call</b>(<i>frame, t</i>)
190
191 <p>
192 Public method used to trace functions calls.
193 </p>
194 <p>
195 This is a variant of the one found in the standard Python
196 profile.py calling fix_frame_filename above.
197 </p>
198 <dl>
199
200 <dt><i>frame</i></dt>
201 <dd>
202 reference to the call frame
203 </dd>
204 <dt><i>t</i></dt>
205 <dd>
206 arguments
207 </dd>
208 </dl>
209 <dl>
210 <dt>Return:</dt>
211 <dd>
212 flag indicating a successful handling (boolean)
213 </dd>
214 </dl>
215 <div align="right"><a href="#top">Up</a></div>
216 <hr />
217 </body></html>

eric ide

mercurial