<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.xhprof.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'xhprof.examples.php',
    1 => 'Приклади',
    2 => 'Приклади',
  ),
  'up' => 
  array (
    0 => 'book.xhprof.php',
    1 => 'Xhprof',
  ),
  'prev' => 
  array (
    0 => 'xhprof.constants.php',
    1 => 'Попередньо визначені константи',
  ),
  'next' => 
  array (
    0 => 'ref.xhprof.php',
    1 => 'Xhprof Функції',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xhprof/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="xhprof.examples" class="chapter">
 <h1 class="title">Приклади</h1>

 <div class="example" id="example-1">
  <p><strong>Приклад #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.php" 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 </span><span style="color: #007700">+ </span><span style="color: #0000BB">XHPROF_FLAGS_MEMORY</span><span style="color: #007700">);<br /><br />for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">&lt;= </span><span style="color: #0000BB">1000</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) {<br />    </span><span style="color: #0000BB">$a </span><span style="color: #007700">= </span><span style="color: #0000BB">$i </span><span style="color: #007700">* </span><span style="color: #0000BB">$i</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$xhprof_data </span><span style="color: #007700">= </span><span style="color: #0000BB">xhprof_disable</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$XHPROF_ROOT </span><span style="color: #007700">= </span><span style="color: #DD0000">"/tools/xhprof/"</span><span style="color: #007700">;<br />include_once </span><span style="color: #0000BB">$XHPROF_ROOT </span><span style="color: #007700">. </span><span style="color: #DD0000">"/xhprof_lib/utils/xhprof_lib.php"</span><span style="color: #007700">;<br />include_once </span><span style="color: #0000BB">$XHPROF_ROOT </span><span style="color: #007700">. </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 </span><span style="color: #007700">= new </span><span style="color: #0000BB">XHProfRuns_Default</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$run_id </span><span style="color: #007700">= </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">, </span><span style="color: #DD0000">"xhprof_testing"</span><span style="color: #007700">);<br /><br />echo </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>Поданий вище приклад виведе щось
схоже на:</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>
<?php manual_footer($setup); ?>