<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/features.dtrace.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'features.dtrace.systemtap.php',
    1 => 'Verwendung von SystemTap mit statischen PHP-DTrace-Sonden',
    2 => 'Verwendung von SystemTap mit statischen PHP-DTrace-Sonden',
  ),
  'up' => 
  array (
    0 => 'features.dtrace.php',
    1 => 'DTrace Dynamic Tracing (Anwendungsanalyse in Echtzeit)',
  ),
  'prev' => 
  array (
    0 => 'features.dtrace.dtrace.php',
    1 => 'PHP mit DTrace verwenden',
  ),
  'next' => 
  array (
    0 => 'funcref.php',
    1 => 'Funktionsreferenz',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'features/dtrace.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="features.dtrace.systemtap" class="sect1">
  <h2 class="title">Verwendung von SystemTap mit statischen PHP-DTrace-Sonden</h2>
  <p class="para">
   Auf einigen Linux-Distributionen kann das Tracing-Tool SystemTap verwendet
   werden, um die statischen DTrace-Sonden von PHP zu überwachen. Diese
   Möglichkeit steht mit PHP 5.4.20 und PHP 5.5 zur Verfügung.
  </p>

  <div class="sect2" id="features.dtrace.systemtap-install">
   <h3 class="title">Installation von PHP mit SystemTap</h3>

   <p class="para">
    Installieren des SystemTap-SDT-Entwicklungspakets:
    <div class="informalexample">
     <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># yum install systemtap-sdt-devel</pre>
</div>
     </div>

    </div>
   </p>

   <p class="para">
    Installieren von PHP mit aktivierten DTrace-Sonden:
    <div class="informalexample">
     <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># ./configure --enable-dtrace ...
# make</pre>
</div>
     </div>

    </div>
   </p>
  </div>

  <div class="sect2" id="features.dtrace.systemtap-list-probes">
   <h3 class="title">Auflistung statischer Sonden mittels SystemTap</h3>

   <p class="para">
    Die statischen Sonden in PHP können mittels <var class="filename">stap</var>
    aufgelistet werden:
    <div class="informalexample">
     <div class="example-contents">
<div class="cdata"><pre>
# stap -l &#039;process.provider(&quot;php&quot;).mark(&quot;*&quot;)&#039; -c &#039;sapi/cli/php -i&#039;
</pre></div>
     </div>

    </div>
   </p>

   <p class="para">
    This outputs:
    <div class="informalexample">
     <div class="example-contents">
<div class="cdata"><pre>
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;compile__file__entry&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;compile__file__return&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;error&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;exception__caught&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;exception__thrown&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;execute__entry&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;execute__return&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;function__entry&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;function__return&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;request__shutdown&quot;)
process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;request__startup&quot;)
</pre></div>
     </div>

    </div>
   </p>
  </div>

  <div class="sect2" id="features.dtrace.systemtap-examples">
   <h3 class="title">Beispiel für die Verwendung von SystemTap mit PHP</h3>

   <p class="para">
    <div class="example" id="example-1">
     <p><strong>Beispiel #1 <var class="filename">all_probes.stp</var> - Verfolgung aller statischen PHP-Sonden mit SystemTap</strong></p>
     <div class="example-contents">
<div class="shellcode"><pre class="shellcode">probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;compile__file__entry&quot;) {
    printf(&quot;Probe compile__file__entry\n&quot;);
    printf(&quot;  compile_file %s\n&quot;, user_string($arg1));
    printf(&quot;  compile_file_translated %s\n&quot;, user_string($arg2));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;compile__file__return&quot;) {
    printf(&quot;Probe compile__file__return\n&quot;);
    printf(&quot;  compile_file %s\n&quot;, user_string($arg1));
    printf(&quot;  compile_file_translated %s\n&quot;, user_string($arg2));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;error&quot;) {
    printf(&quot;Probe error\n&quot;);
    printf(&quot;  errormsg %s\n&quot;, user_string($arg1));
    printf(&quot;  request_file %s\n&quot;, user_string($arg2));
    printf(&quot;  lineno %d\n&quot;, $arg3);
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;exception__caught&quot;) {
    printf(&quot;Probe exception__caught\n&quot;);
    printf(&quot;  classname %s\n&quot;, user_string($arg1));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;exception__thrown&quot;) {
    printf(&quot;Probe exception__thrown\n&quot;);
    printf(&quot;  classname %s\n&quot;, user_string($arg1));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;execute__entry&quot;) {
    printf(&quot;Probe execute__entry\n&quot;);
    printf(&quot;  request_file %s\n&quot;, user_string($arg1));
    printf(&quot;  lineno %d\n&quot;, $arg2);
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;execute__return&quot;) {
    printf(&quot;Probe execute__return\n&quot;);
    printf(&quot;  request_file %s\n&quot;, user_string($arg1));
    printf(&quot;  lineno %d\n&quot;, $arg2);
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;function__entry&quot;) {
    printf(&quot;Probe function__entry\n&quot;);
    printf(&quot;  function_name %s\n&quot;, user_string($arg1));
    printf(&quot;  request_file %s\n&quot;, user_string($arg2));
    printf(&quot;  lineno %d\n&quot;, $arg3);
    printf(&quot;  classname %s\n&quot;, user_string($arg4));
    printf(&quot;  scope %s\n&quot;, user_string($arg5));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;function__return&quot;) {
    printf(&quot;Probe function__return: %s\n&quot;, user_string($arg1));
    printf(&quot; function_name %s\n&quot;, user_string($arg1));
    printf(&quot;  request_file %s\n&quot;, user_string($arg2));
    printf(&quot;  lineno %d\n&quot;, $arg3);
    printf(&quot;  classname %s\n&quot;, user_string($arg4));
    printf(&quot;  scope %s\n&quot;, user_string($arg5));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;request__shutdown&quot;) {
    printf(&quot;Probe request__shutdown\n&quot;);
    printf(&quot;  file %s\n&quot;, user_string($arg1));
    printf(&quot;  request_uri %s\n&quot;, user_string($arg2));
    printf(&quot;  request_method %s\n&quot;, user_string($arg3));
}
probe process(&quot;sapi/cli/php&quot;).provider(&quot;php&quot;).mark(&quot;request__startup&quot;) {
    printf(&quot;Probe request__startup\n&quot;);
    printf(&quot;  file %s\n&quot;, user_string($arg1));
    printf(&quot;  request_uri %s\n&quot;, user_string($arg2));
    printf(&quot;  request_method %s\n&quot;, user_string($arg3));
}</pre>
</div>
     </div>

    </div>
   </p>
   <p class="para">
    Das obige Skript verfolgt während der gesamten Dauer eines laufenden
    PHP-Skripts alle statischen Sondenpunkte des PHP-Kerns:
    <div class="informalexample">
     <div class="example-contents">
<div class="cdata"><pre>
# stap -c &#039;sapi/cli/php test.php&#039; all_probes.stp
</pre></div>
     </div>

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