wget http://pecl.php.net/get/xhprof-0.9.2.tgz tar zxf xhprof-0.9.2.tgz cd xhprof-0.9.2 cp -r xhprof_html xhprof_lib <directory_for_htdocs> cd extension phpize ./configure make make install
[xhprof] extension=xhprof.so ; ; directory used by default implementation of the iXHProfRuns ; interface (namely, the XHProfRuns_Default class) for storing ; XHProf runs. ; 记得<directory_for_storing_xhprof_runs>WEB要有写入权限 xhprof.output_dir=<directory_for_storing_xhprof_runs>
wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.3.tar.gz tar zxf graphviz-2.26.3.tar.gz cd graphviz-2.26.3 ./configure make make install
//author http://www.lai18.com xhprof_enable();//打开xhprof /******程序逻辑 Start******/ function test1(){ sleep(3); return; } function test2(){ test1(); } function test3(){ test2(); } function p(){ echo '<h3>xhprof test</h3>'; } p(); test3(); /******程序逻辑 End******/ $xhprof_data = xhprof_disable();//关闭xhprof //保存xhprof数据 include_once '../xhprof_lib/utils/xhprof_lib.php'; include_once '../xhprof_lib/utils/xhprof_runs.php'; $xhprof_runs = new XHProfRuns_Default(); $xhprof_source = 'xhprof_test'; $run_id = $xhprof_runs->save_run($xhprof_data, $xhprof_source); $report_url = 'http://xhprof.rebill.info/index.php?run='.$run_id.'&source='.$xhprof_source; echo '<br>'; echo 'view the performance report:<a href="'.$report_url.'" target="_blank">'.$report_url.'</a>';
原文地址:http://blog.csdn.net/hello_katty/article/details/45815039