<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'features.dtrace.systemtap.php',
    1 => 'PHP DTrace 静的プローブとともに SystemTap を使用',
    2 => 'PHP DTrace 静的プローブとともに SystemTap を使用',
  ),
  'up' => 
  array (
    0 => 'features.dtrace.php',
    1 => 'DTrace 動的トレーシング',
  ),
  'prev' => 
  array (
    0 => 'features.dtrace.dtrace.php',
    1 => 'PHP および DTrace の使用',
  ),
  'next' => 
  array (
    0 => 'funcref.php',
    1 => '関数リファレンス',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    '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">PHP DTrace 静的プローブとともに SystemTap を使用</h2>
  <p class="para">
   一部の Linux ディストリビューションでは、
   PHP の静的な DTrace プローブをトレースするために
   SystemTap トレーシング・ユーティリティを使用できます。
   これは、PHP 5.4.20 および PHP 5.5 で使用できます。
  </p>

  <div class="sect2" id="features.dtrace.systemtap-install">
   <h3 class="title">SystemTap とともに PHP をインストール</h3>

   <p class="para">
    SystemTap SDT 開発パッケージをインストールします。
    <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">
    DTrace プローブが有効化された状態で PHP をインストールします。
    <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">SystemTap による静的プローブ一覧</h3>

   <p class="para">
    <var class="filename">stap</var> を使用して PHP の静的プローブを一覧表示できます。
    <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">
    この出力です。
    <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">PHP についての SystemTap の例</h3>

   <p class="para">
    <div class="example" id="example-1">
     <p><strong>例1 SystemTap を使用してすべての PHP 静的プローブをトレースするための<var class="filename">all_probes.stp</var></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">
    上記のスクリプトは、PHP スクリプト実行中の期間全体にわたって、
    すべてのコア PHP 静的プローブ・ポイントをトレースします。
    <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); ?>