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

changeset 5141
bc64243b7672
parent 5126
d28b92dabc2b
parent 5140
01484c0afbc6
child 5144
1ab536d25072
equal deleted inserted replaced
5126:d28b92dabc2b 5141:bc64243b7672
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.DebugClients.Python.PyProfile</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.DebugClients.Python.PyProfile</h1>
23 <p>
24 Module defining additions to the standard Python profile.py.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#PyProfile">PyProfile</a></td>
34 <td>Class extending the standard Python profiler with additional methods.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="PyProfile" ID="PyProfile"></a>
43 <h2>PyProfile</h2>
44 <p>
45 Class extending the standard Python profiler with additional methods.
46 </p><p>
47 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
49 on subsequent calls, to store a profile dump to a standard filename and
50 to erase these caches.
51 </p>
52 <h3>Derived from</h3>
53 profile.Profile
54 <h3>Class Attributes</h3>
55 <table>
56 <tr><td>dispatch</td></tr>
57 </table>
58 <h3>Class Methods</h3>
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Methods</h3>
63 <table>
64 <tr>
65 <td><a href="#PyProfile.__init__">PyProfile</a></td>
66 <td>Constructor</td>
67 </tr><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><tr>
71 <td><a href="#PyProfile.dump_stats">dump_stats</a></td>
72 <td>Public method to dump the statistics data.</td>
73 </tr><tr>
74 <td><a href="#PyProfile.erase">erase</a></td>
75 <td>Public method to erase the collected timing data.</td>
76 </tr><tr>
77 <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>
79 </tr><tr>
80 <td><a href="#PyProfile.save">save</a></td>
81 <td>Public method to store the collected profile data.</td>
82 </tr><tr>
83 <td><a href="#PyProfile.trace_dispatch_call">trace_dispatch_call</a></td>
84 <td>Public method used to trace functions calls.</td>
85 </tr>
86 </table>
87 <h3>Static Methods</h3>
88 <table>
89 <tr><td>None</td></tr>
90 </table>
91 <a NAME="PyProfile.__init__" ID="PyProfile.__init__"></a>
92 <h4>PyProfile (Constructor)</h4>
93 <b>PyProfile</b>(<i>basename, timer=None, bias=None</i>)
94 <p>
95 Constructor
96 </p><dl>
97 <dt><i>basename</i></dt>
98 <dd>
99 name of the script to be profiled (string)
100 </dd><dt><i>timer</i></dt>
101 <dd>
102 function defining the timing calculation
103 </dd><dt><i>bias</i></dt>
104 <dd>
105 calibration value (float)
106 </dd>
107 </dl><a NAME="PyProfile.__restore" ID="PyProfile.__restore"></a>
108 <h4>PyProfile.__restore</h4>
109 <b>__restore</b>(<i></i>)
110 <p>
111 Private method to restore the timing data from the timing cache.
112 </p><a NAME="PyProfile.dump_stats" ID="PyProfile.dump_stats"></a>
113 <h4>PyProfile.dump_stats</h4>
114 <b>dump_stats</b>(<i>file</i>)
115 <p>
116 Public method to dump the statistics data.
117 </p><dl>
118 <dt><i>file</i></dt>
119 <dd>
120 name of the file to write to (string)
121 </dd>
122 </dl><a NAME="PyProfile.erase" ID="PyProfile.erase"></a>
123 <h4>PyProfile.erase</h4>
124 <b>erase</b>(<i></i>)
125 <p>
126 Public method to erase the collected timing data.
127 </p><a NAME="PyProfile.fix_frame_filename" ID="PyProfile.fix_frame_filename"></a>
128 <h4>PyProfile.fix_frame_filename</h4>
129 <b>fix_frame_filename</b>(<i>frame</i>)
130 <p>
131 Public method used to fixup the filename for a given frame.
132 </p><p>
133 The logic employed here is that if a module was loaded
134 from a .pyc file, then the correct .py to operate with
135 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
137 filename embedded and thus what is readable in the code object
138 of the frame object is the fully qualified filepath when the
139 pyc is generated. If files are moved from machine to machine
140 this can break debugging as the .pyc will refer to the .py
141 on the original machine. Another case might be sharing
142 code over a network... This logic deals with that.
143 </p><dl>
144 <dt><i>frame</i></dt>
145 <dd>
146 the frame object
147 </dd>
148 </dl><dl>
149 <dt>Returns:</dt>
150 <dd>
151 fixed up file name (string)
152 </dd>
153 </dl><a NAME="PyProfile.save" ID="PyProfile.save"></a>
154 <h4>PyProfile.save</h4>
155 <b>save</b>(<i></i>)
156 <p>
157 Public method to store the collected profile data.
158 </p><a NAME="PyProfile.trace_dispatch_call" ID="PyProfile.trace_dispatch_call"></a>
159 <h4>PyProfile.trace_dispatch_call</h4>
160 <b>trace_dispatch_call</b>(<i>frame, t</i>)
161 <p>
162 Public method used to trace functions calls.
163 </p><p>
164 This is a variant of the one found in the standard Python
165 profile.py calling fix_frame_filename above.
166 </p><dl>
167 <dt><i>frame</i></dt>
168 <dd>
169 reference to the call frame
170 </dd><dt><i>t</i></dt>
171 <dd>
172 arguments of the call
173 </dd>
174 </dl><dl>
175 <dt>Returns:</dt>
176 <dd>
177 flag indicating a handled call
178 </dd>
179 </dl>
180 <div align="right"><a href="#top">Up</a></div>
181 <hr />
182 </body></html>

eric ide

mercurial