⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apd.examples.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Examples</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="apd.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.apd.html">APD Functions</a></div> <div class="up"><a href="book.apd.html">APD</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <div id="apd.examples.usage" class="section">  <h2 class="title">How to use PHP-APD in your scripts</h2>  <div class="procedure">   <ol type="1"><li>    <p class="para">     As the first line of your PHP script, call the apd_set_pprof_trace() function     to start the trace:    </p>    <p class="para">     <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000">apd_set_pprof_trace();</span></code></div>     </div>    </p>    <p class="para">     You can insert the line anywhere in your script, but if you do not start     tracing at the beginning of your script you discard profile data that might     otherwise lead you to a performance bottleneck.    </p>   </li>   <li>    <p class="para">     Now run your script. The dump output will be written to     <var class="filename">apd.dumpdir/pprof_pid.ext</var>.     <div class="tip"><b class="tip">Tip</b>     <p class="para">       If you&#039;re running the CGI version of PHP, you will need to add the &#039;-e&#039;       flag to enable extended information for apd to work properly. For       example:        <strong class="userinput"><code>php -e -f script.php</code></strong>     </p>     </div>    </p>   </li>   <li>    <p class="para">     To display formatted profile data, issue the <strong class="command">pprofp</strong>     command with the sort and display options of your choice. The formatted     output will look something like:     <div class="example-contents"><pre><div class="cdata"><pre>bash-2.05b$ pprofp -R /tmp/pprof.22141.0Trace for /home/dan/testapd.phpTotal Elapsed Time = 0.00Total System Time  = 0.00Total User Time    = 0.00Real         User        System             secs/    cumm%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  Memory Usage Name--------------------------------------------------------------------------------------100.0 0.00 0.00  0.00 0.00  0.00 0.00     1  0.0000   0.0009            0 main56.9 0.00 0.00  0.00 0.00  0.00 0.00     1  0.0005   0.0005            0 apd_set_pprof_trace28.0 0.00 0.00  0.00 0.00  0.00 0.00    10  0.0000   0.0000            0 preg_replace14.3 0.00 0.00  0.00 0.00  0.00 0.00    10  0.0000   0.0000            0 str_replace</pre></div>     </pre></div>    </p>    <p class="para">     The -R option used in this example sorts the profile table by the amount     of real time the script spent executing a given function. The &quot;cumm call&quot;     column reveals how many times each function was called, and the &quot;s/call&quot;     column reveals how many seconds each call to the function required, on     average.    </p>   </li>   <li>    <p class="para">    To generate a calltree file that you can import into the KCacheGrind    profile analysis application, issue the <strong class="command">pprof2calltree</strong>    comand.    </p>   </li>  </ol></div> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="apd.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.apd.html">APD Functions</a></div> <div class="up"><a href="book.apd.html">APD</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -