| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-hotshot.stats.html" /> |
| 13 | <link rel="prev" href="module-hotshot.html" /> |
| 14 | <link rel="parent" href="module-hotshot.html" /> |
| 15 | <link rel="next" href="module-hotshot.stats.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>10.9.1 Profile Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="10.9 hotshot " |
| 25 | href="module-hotshot.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="10.9 hotshot " |
| 28 | href="module-hotshot.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="10.9.2 Using hotshot data" |
| 31 | href="module-hotshot.stats.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-hotshot.html">10.9 hotshot </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-hotshot.html">10.9 hotshot </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="module-hotshot.stats.html">10.9.2 Using hotshot data</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0012910000000000000000"></A><A NAME="hotshot-objects"></A> |
| 56 | <BR> |
| 57 | 10.9.1 Profile Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | Profile objects have the following methods: |
| 62 | |
| 63 | <P> |
| 64 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 65 | <td><nobr><b><tt id='l2h-3123' xml:id='l2h-3123' class="method">addinfo</tt></b>(</nobr></td> |
| 66 | <td><var>key, value</var>)</td></tr></table></dt> |
| 67 | <dd> |
| 68 | Add an arbitrary labelled value to the profile output. |
| 69 | </dl> |
| 70 | |
| 71 | <P> |
| 72 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 73 | <td><nobr><b><tt id='l2h-3124' xml:id='l2h-3124' class="method">close</tt></b>(</nobr></td> |
| 74 | <td><var></var>)</td></tr></table></dt> |
| 75 | <dd> |
| 76 | Close the logfile and terminate the profiler. |
| 77 | </dl> |
| 78 | |
| 79 | <P> |
| 80 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 81 | <td><nobr><b><tt id='l2h-3125' xml:id='l2h-3125' class="method">fileno</tt></b>(</nobr></td> |
| 82 | <td><var></var>)</td></tr></table></dt> |
| 83 | <dd> |
| 84 | Return the file descriptor of the profiler's log file. |
| 85 | </dl> |
| 86 | |
| 87 | <P> |
| 88 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 89 | <td><nobr><b><tt id='l2h-3126' xml:id='l2h-3126' class="method">run</tt></b>(</nobr></td> |
| 90 | <td><var>cmd</var>)</td></tr></table></dt> |
| 91 | <dd> |
| 92 | Profile an <tt class="keyword">exec</tt>-compatible string in the script environment. |
| 93 | The globals from the <tt class="module"><a href="module-main.html">__main__</a></tt> module are used as |
| 94 | both the globals and locals for the script. |
| 95 | </dl> |
| 96 | |
| 97 | <P> |
| 98 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 99 | <td><nobr><b><tt id='l2h-3127' xml:id='l2h-3127' class="method">runcall</tt></b>(</nobr></td> |
| 100 | <td><var>func, *args, **keywords</var>)</td></tr></table></dt> |
| 101 | <dd> |
| 102 | Profile a single call of a callable. |
| 103 | Additional positional and keyword arguments may be passed |
| 104 | along; the result of the call is returned, and exceptions are |
| 105 | allowed to propagate cleanly, while ensuring that profiling is |
| 106 | disabled on the way out. |
| 107 | </dl> |
| 108 | |
| 109 | <P> |
| 110 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 111 | <td><nobr><b><tt id='l2h-3128' xml:id='l2h-3128' class="method">runctx</tt></b>(</nobr></td> |
| 112 | <td><var>cmd, globals, locals</var>)</td></tr></table></dt> |
| 113 | <dd> |
| 114 | Evaluate an <tt class="keyword">exec</tt>-compatible string in a specific environment. |
| 115 | The string is compiled before profiling begins. |
| 116 | </dl> |
| 117 | |
| 118 | <P> |
| 119 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 120 | <td><nobr><b><tt id='l2h-3129' xml:id='l2h-3129' class="method">start</tt></b>(</nobr></td> |
| 121 | <td><var></var>)</td></tr></table></dt> |
| 122 | <dd> |
| 123 | Start the profiler. |
| 124 | </dl> |
| 125 | |
| 126 | <P> |
| 127 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 128 | <td><nobr><b><tt id='l2h-3130' xml:id='l2h-3130' class="method">stop</tt></b>(</nobr></td> |
| 129 | <td><var></var>)</td></tr></table></dt> |
| 130 | <dd> |
| 131 | Stop the profiler. |
| 132 | </dl> |
| 133 | |
| 134 | <P> |
| 135 | |
| 136 | <DIV CLASS="navigation"> |
| 137 | <div class='online-navigation'> |
| 138 | <p></p><hr /> |
| 139 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 140 | <tr> |
| 141 | <td class='online-navigation'><a rel="prev" title="10.9 hotshot " |
| 142 | href="module-hotshot.html"><img src='../icons/previous.png' |
| 143 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 144 | <td class='online-navigation'><a rel="parent" title="10.9 hotshot " |
| 145 | href="module-hotshot.html"><img src='../icons/up.png' |
| 146 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 147 | <td class='online-navigation'><a rel="next" title="10.9.2 Using hotshot data" |
| 148 | href="module-hotshot.stats.html"><img src='../icons/next.png' |
| 149 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 150 | <td align="center" width="100%">Python Library Reference</td> |
| 151 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 152 | href="contents.html"><img src='../icons/contents.png' |
| 153 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 154 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 155 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 156 | <td class='online-navigation'><a rel="index" title="Index" |
| 157 | href="genindex.html"><img src='../icons/index.png' |
| 158 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 159 | </tr></table> |
| 160 | <div class='online-navigation'> |
| 161 | <b class="navlabel">Previous:</b> |
| 162 | <a class="sectref" rel="prev" href="module-hotshot.html">10.9 hotshot </A> |
| 163 | <b class="navlabel">Up:</b> |
| 164 | <a class="sectref" rel="parent" href="module-hotshot.html">10.9 hotshot </A> |
| 165 | <b class="navlabel">Next:</b> |
| 166 | <a class="sectref" rel="next" href="module-hotshot.stats.html">10.9.2 Using hotshot data</A> |
| 167 | </div> |
| 168 | </div> |
| 169 | <hr /> |
| 170 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 171 | </DIV> |
| 172 | <!--End of Navigation Panel--> |
| 173 | <ADDRESS> |
| 174 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 175 | </ADDRESS> |
| 176 | </BODY> |
| 177 | </HTML> |