eric6/Documentation/Source/eric6.DebugClients.Python.PyProfile.html

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

eric ide

mercurial