|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.DebugClients.Python.PyProfile</title> |
|
6 <style> |
|
7 b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' |
|
8 </style> |
|
9 </head> |
|
10 <body><a NAME="top" ID="top"></a> |
|
11 <h1>eric5.DebugClients.Python.PyProfile</h1> |
|
12 <p> |
|
13 Module defining additions to the standard Python profile.py. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#PyProfile">PyProfile</a></td> |
|
23 <td>Class extending the standard Python profiler with additional methods.</td> |
|
24 </tr> |
|
25 </table> |
|
26 <h3>Functions</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <hr /><hr /> |
|
31 <a NAME="PyProfile" ID="PyProfile"></a> |
|
32 <h2>PyProfile</h2> |
|
33 <p> |
|
34 Class extending the standard Python profiler with additional methods. |
|
35 </p><p> |
|
36 This class extends the standard Python profiler by the functionality to |
|
37 save the collected timing data in a timing cache, to restore these data |
|
38 on subsequent calls, to store a profile dump to a standard filename and |
|
39 to erase these caches. |
|
40 </p> |
|
41 <h3>Derived from</h3> |
|
42 profile.Profile |
|
43 <h3>Class Attributes</h3> |
|
44 <table> |
|
45 <tr><td>dispatch</td></tr> |
|
46 </table> |
|
47 <h3>Methods</h3> |
|
48 <table> |
|
49 <tr> |
|
50 <td><a href="#PyProfile.__init__">PyProfile</a></td> |
|
51 <td>Constructor</td> |
|
52 </tr><tr> |
|
53 <td><a href="#PyProfile.__restore">__restore</a></td> |
|
54 <td>Private method to restore the timing data from the timing cache.</td> |
|
55 </tr><tr> |
|
56 <td><a href="#PyProfile.dump_stats">dump_stats</a></td> |
|
57 <td>Public method to dump the statistics data.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#PyProfile.erase">erase</a></td> |
|
60 <td>Public method to erase the collected timing data.</td> |
|
61 </tr><tr> |
|
62 <td><a href="#PyProfile.fix_frame_filename">fix_frame_filename</a></td> |
|
63 <td>Public method used to fixup the filename for a given frame.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#PyProfile.save">save</a></td> |
|
66 <td>Public method to store the collected profile data.</td> |
|
67 </tr><tr> |
|
68 <td><a href="#PyProfile.trace_dispatch_call">trace_dispatch_call</a></td> |
|
69 <td>Private method used to trace functions calls.</td> |
|
70 </tr> |
|
71 </table> |
|
72 <a NAME="PyProfile.__init__" ID="PyProfile.__init__"></a> |
|
73 <h4>PyProfile (Constructor)</h4> |
|
74 <b>PyProfile</b>(<i>basename, timer=None, bias=None</i>) |
|
75 <p> |
|
76 Constructor |
|
77 </p><dl> |
|
78 <dt><i>basename</i></dt> |
|
79 <dd> |
|
80 name of the script to be profiled (string) |
|
81 </dd><dt><i>timer</i></dt> |
|
82 <dd> |
|
83 function defining the timing calculation |
|
84 </dd><dt><i>bias</i></dt> |
|
85 <dd> |
|
86 calibration value (float) |
|
87 </dd> |
|
88 </dl><a NAME="PyProfile.__restore" ID="PyProfile.__restore"></a> |
|
89 <h4>PyProfile.__restore</h4> |
|
90 <b>__restore</b>(<i></i>) |
|
91 <p> |
|
92 Private method to restore the timing data from the timing cache. |
|
93 </p><a NAME="PyProfile.dump_stats" ID="PyProfile.dump_stats"></a> |
|
94 <h4>PyProfile.dump_stats</h4> |
|
95 <b>dump_stats</b>(<i>file</i>) |
|
96 <p> |
|
97 Public method to dump the statistics data. |
|
98 </p><dl> |
|
99 <dt><i>file</i></dt> |
|
100 <dd> |
|
101 name of the file to write to (string) |
|
102 </dd> |
|
103 </dl><a NAME="PyProfile.erase" ID="PyProfile.erase"></a> |
|
104 <h4>PyProfile.erase</h4> |
|
105 <b>erase</b>(<i></i>) |
|
106 <p> |
|
107 Public method to erase the collected timing data. |
|
108 </p><a NAME="PyProfile.fix_frame_filename" ID="PyProfile.fix_frame_filename"></a> |
|
109 <h4>PyProfile.fix_frame_filename</h4> |
|
110 <b>fix_frame_filename</b>(<i>frame</i>) |
|
111 <p> |
|
112 Public method used to fixup the filename for a given frame. |
|
113 </p><p> |
|
114 The logic employed here is that if a module was loaded |
|
115 from a .pyc file, then the correct .py to operate with |
|
116 should be in the same path as the .pyc. The reason this |
|
117 logic is needed is that when a .pyc file is generated, the |
|
118 filename embedded and thus what is readable in the code object |
|
119 of the frame object is the fully qualified filepath when the |
|
120 pyc is generated. If files are moved from machine to machine |
|
121 this can break debugging as the .pyc will refer to the .py |
|
122 on the original machine. Another case might be sharing |
|
123 code over a network... This logic deals with that. |
|
124 </p><dl> |
|
125 <dt><i>frame</i></dt> |
|
126 <dd> |
|
127 the frame object |
|
128 </dd> |
|
129 </dl><a NAME="PyProfile.save" ID="PyProfile.save"></a> |
|
130 <h4>PyProfile.save</h4> |
|
131 <b>save</b>(<i></i>) |
|
132 <p> |
|
133 Public method to store the collected profile data. |
|
134 </p><a NAME="PyProfile.trace_dispatch_call" ID="PyProfile.trace_dispatch_call"></a> |
|
135 <h4>PyProfile.trace_dispatch_call</h4> |
|
136 <b>trace_dispatch_call</b>(<i>frame, t</i>) |
|
137 <p> |
|
138 Private method used to trace functions calls. |
|
139 </p><p> |
|
140 This is a variant of the one found in the standard Python |
|
141 profile.py calling fix_frame_filename above. |
|
142 </p> |
|
143 <div align="right"><a href="#top">Up</a></div> |
|
144 <hr /> |
|
145 </body></html> |