<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.luasandbox.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'luasandbox.getprofilerfunctionreport.php',
    1 => 'LuaSandbox::getProfilerFunctionReport',
    2 => 'Fetch profiler data',
  ),
  'up' => 
  array (
    0 => 'class.luasandbox.php',
    1 => 'LuaSandbox',
  ),
  'prev' => 
  array (
    0 => 'luasandbox.getpeakmemoryusage.php',
    1 => 'LuaSandbox::getPeakMemoryUsage',
  ),
  'next' => 
  array (
    0 => 'luasandbox.getversioninfo.php',
    1 => 'LuaSandbox::getVersionInfo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/luasandbox/luasandbox/getprofilerfunctionreport.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="luasandbox.getprofilerfunctionreport" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">LuaSandbox::getProfilerFunctionReport</h1>
  <p class="verinfo">(PECL luasandbox &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">LuaSandbox::getProfilerFunctionReport</span> &mdash; <span class="dc-title">Fetch profiler data</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-luasandbox.getprofilerfunctionreport-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>LuaSandbox::getProfilerFunctionReport</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$units</code><span class="initializer"> = LuaSandbox::SECONDS</span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="simpara">
   For a profiling instance previously started by
   <span class="methodname"><a href="luasandbox.enableprofiler.php" class="methodname">LuaSandbox::enableProfiler()</a></span>, get a
   report of the cost of each function.
  </p>
  <p class="simpara">
   The measurement unit used for the cost is determined by the
   <var class="varname">$units</var> parameter:
  </p>
  <dl>
   
    <dt><strong><code><a href="class.luasandbox.php#luasandbox.constants.samples">LuaSandbox::SAMPLES</a></code></strong></dt>
    <dd><span class="simpara">Measure in number of samples.</span></dd>
   
   
    <dt><strong><code><a href="class.luasandbox.php#luasandbox.constants.seconds">LuaSandbox::SECONDS</a></code></strong></dt>
    <dd><span class="simpara">Measure in seconds of CPU time.</span></dd>
   
   
    <dt><strong><code><a href="class.luasandbox.php#luasandbox.constants.percent">LuaSandbox::PERCENT</a></code></strong></dt>
    <dd><span class="simpara">Measure percentage of CPU time.</span></dd>
   
  </dl>
 </div>


 <div class="refsect1 parameters" id="refsect1-luasandbox.getprofilerfunctionreport-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">units</code></dt>
    <dd>
     <span class="simpara">
      Measurement unit constant.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-luasandbox.getprofilerfunctionreport-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Returns profiler measurements, sorted in descending order, as an associative
   <span class="type"><a href="language.types.array.php" class="type array">array</a></span>. Keys are the Lua function names (with source file and line
   defined in angle brackets), values are the measurements as <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   or <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    On Windows, this function always returns an empty array. On operating systems that do
    not support <strong><code>CLOCK_THREAD_CPUTIME_ID</code></strong>, such as FreeBSD
    and Mac OS X, this function will report the elapsed wall-clock time, not
    CPU time.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-luasandbox.getprofilerfunctionreport-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 Profiling Lua code</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// create a new LuaSandbox<br /></span><span style="color: #0000BB">$sandbox </span><span style="color: #007700">= new </span><span style="color: #0000BB">LuaSandbox</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// Start the profiler<br /></span><span style="color: #0000BB">$sandbox</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">enableProfiler</span><span style="color: #007700">( </span><span style="color: #0000BB">0.01 </span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// ... Execute some Lua code here ...<br /><br />// Fetch the profiler data<br /></span><span style="color: #0000BB">$data </span><span style="color: #007700">= </span><span style="color: #0000BB">$sandbox</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProfilerFunctionReport</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


</div><?php manual_footer($setup); ?>