<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Start xhprof profiler</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xhprof-disable.html">xhprof_disable</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xhprof-sample-disable.html">xhprof_sample_disable</a></div> <div class="up"><a href="ref.xhprof.html">Xhprof Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.xhprof-enable" class="refentry"> <div class="refnamediv"> <h1 class="refname">xhprof_enable</h1> <p class="verinfo">(PECL xhprof >= 0.9.0)</p><p class="refpurpose"><span class="refname">xhprof_enable</span> — <span class="dc-title">Start xhprof profiler</span></p> </div> <div class="refsect1 description" id="refsect1-function.xhprof-enable-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>xhprof_enable</strong></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code></span> ]] )</div> <p class="para rdfs-comment"> Start xhprof profiling. </p> </div> <div class="refsect1 parameters" id="refsect1-function.xhprof-enable-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">flags</code></em></span> <dd> <p class="para"> Optional flags to add additional information to the profiling. See the <a href="xhprof.constants.html" class="link">XHprof constants</a> for further information about these flags, e.g., <strong><code>XHPROF_FLAGS_MEMORY</code></strong> to enable memory profiling. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">options</code></em></span> <dd> <p class="para"> An <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of optional options, namely, the 'ignored_functions' option to pass in functions to be ignored during profiling. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.xhprof-enable-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> <strong><code>NULL</code></strong> </p> </div> <div class="refsect1 changelog" id="refsect1-function.xhprof-enable-changelog"> <h3 class="title">Changelog</h3> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>0.9.2</td> <td> The optional <em><code class="parameter">options</code></em> parameter was added. </td> </tr> </tbody> </table> </div> <div class="refsect1 examples" id="refsect1-function.xhprof-enable-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-588"> <p><strong>Example #1 <span class="function"><strong>xhprof_enable()</strong></span> examples</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// 1. elapsed time + memory + CPU profiling; and ignore built-in (internal) functions<br /></span><span style="color: #0000BB">xhprof_enable</span><span style="color: #007700">(</span><span style="color: #0000BB">XHPROF_FLAGS_NO_BUILTINS </span><span style="color: #007700">| </span><span style="color: #0000BB">XHPROF_FLAGS_CPU </span><span style="color: #007700">| </span><span style="color: #0000BB">XHPROF_FLAGS_MEMORY</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 2. elapsed time profiling; ignore call_user_func* during profiling<br /></span><span style="color: #0000BB">xhprof_enable</span><span style="color: #007700">(<br /> </span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /> array(</span><span style="color: #DD0000">'ignored_functions' </span><span style="color: #007700">=> array(</span><span style="color: #DD0000">'call_user_func'</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'call_user_func_array'</span><span style="color: #007700">)));<br /> <br /></span><span style="color: #FF8000">// 3. elapsed time + memory profiling; ignore call_user_func* during profiling<br /></span><span style="color: #0000BB">xhprof_enable</span><span style="color: #007700">(<br /> </span><span style="color: #0000BB">XHPROF_FLAGS_MEMORY</span><span style="color: #007700">,<br /> array(</span><span style="color: #DD0000">'ignored_functions' </span><span style="color: #007700">=> array(</span><span style="color: #DD0000">'call_user_func'</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'call_user_func_array'</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </div> <div class="refsect1 seealso" id="refsect1-function.xhprof-enable-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.xhprof-disable.html" class="function" rel="rdfs-seeAlso">xhprof_disable()</a> - Stops xhprof profiler</span></li> <li class="member"> <span class="function"><a href="function.xhprof-sample-enable.html" class="function" rel="rdfs-seeAlso">xhprof_sample_enable()</a> - Start XHProf profiling in sampling mode</span></li> <li class="member"> <span class="function"><a href="function.memory-get-usage.html" class="function" rel="rdfs-seeAlso">memory_get_usage()</a> - Returns the amount of memory allocated to PHP</span></li> <li class="member"> <span class="function"><a href="function.getrusage.html" class="function" rel="rdfs-seeAlso">getrusage()</a> - Gets the current resource usages</span></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xhprof-disable.html">xhprof_disable</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xhprof-sample-disable.html">xhprof_sample_disable</a></div> <div class="up"><a href="ref.xhprof.html">Xhprof Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>