Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12673

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Examples</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xhprof.constants.html">Predefined Constants</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.xhprof.html">Xhprof Functions</a></div>
 <div class="up"><a href="book.xhprof.html">Xhprof</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="xhprof.examples" class="chapter">
 <h1>Examples</h1>

 <div class="example" id="example-586">
  <p><strong>Example #1 Xhprof example with the optional GUI</strong></p>
  <div class="example-contents"><p>
   This example starts and stops the profiler, then uses the bundled
   GUI interface to save and parse the results. In other words, the
   code from the extension itself ends at the call to
    <span class="function"><a href="function.xhprof-disable.html" class="function">xhprof_disable()</a></span>.
  </p></div>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />xhprof_enable</span><span style="color: #007700">(</span><span style="color: #0000BB">XHPROF_FLAGS_CPU&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">XHPROF_FLAGS_MEMORY</span><span style="color: #007700">);<br /><br />for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">1000</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$xhprof_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xhprof_disable</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$XHPROF_ROOT&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"/tools/xhprof/"</span><span style="color: #007700">;<br />include_once&nbsp;</span><span style="color: #0000BB">$XHPROF_ROOT&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"/xhprof_lib/utils/xhprof_lib.php"</span><span style="color: #007700">;<br />include_once&nbsp;</span><span style="color: #0000BB">$XHPROF_ROOT&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"/xhprof_lib/utils/xhprof_runs.php"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$xhprof_runs&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">XHProfRuns_Default</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$run_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xhprof_runs</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">save_run</span><span style="color: #007700">(</span><span style="color: #0000BB">$xhprof_data</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"xhprof_testing"</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"http://localhost/xhprof/xhprof_html/index.php?run=</span><span style="color: #007700">{</span><span style="color: #0000BB">$run_id</span><span style="color: #007700">}</span><span style="color: #DD0000">&amp;source=xhprof_testing\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

  <div class="example-contents"><p>The above example will output
something similar to:</p></div>
  <div class="example-contents screen">
<div class="cdata"><pre>
http://localhost/xhprof/xhprof_html/index.php?run=t11_4bdf44d21121f&amp;source=xhprof_testing
</pre></div>
  </div>
 </div>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xhprof.constants.html">Predefined Constants</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.xhprof.html">Xhprof Functions</a></div>
 <div class="up"><a href="book.xhprof.html">Xhprof</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>