php效能分析工具xhprof

來源:互聯網
上載者:User
 wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar -zxvf xhprof-0.9.4.tgz  cd xhprof-0.9.4 cd extension/ phpize ./configuremake && make install、
增加配置php.ini
 
[xhprof]extension=xhprof.soxhprof.output_dir=/tmp
//
使用xhprof會在nginx下報502 Bad Gateway錯誤

我的運行環境Yii + nginx +php5.4.25+centos

 

bug修複

xhprof_enable()

xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

修改為:

xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY) 1.nginx配置nginx.conf

 fastcgi_param PHP_VALUE "auto_prepend_file=/etc/config_home/inject.php"; 2.php配置:php.ini auto_prepend_file =/etc/config_home/inject.php 3. php檔案 //開啟xhprof xhprof_enable(XHPROF_FLAGS_NO_BUILTINS|XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU); //在程式結束後收集資料 register_shutdown_function(function() {     $xhprof_data        = xhprof_disable(); include_once "/var/ms/public/xhprof_lib/utils/xhprof_lib.php";   include_once "/var/ms/public/xhprof_lib/utils/xhprof_runs.php";   $objXhprofRun = new XHProfRuns_Default();  

// 第一個參數j是xhprof_disable()函數返回的運行資訊 // 第二個參數是自訂的命名空間字串(任一字元串), // 返回運行ID,用這個ID查看相關的運行結果 $run_id = $objXhprofRun->save_run($xhprof_data, "xhprof");     //讓資料收集程式在後台運行     if (function_exists('fastcgi_finish_request')) {         fastcgi_finish_request();     } });
4.xhprof_html 5.xhprof_lib 備忘說明 Incl. CPU (microsecs):包含內建函式 CPU 花費的時間,單位微秒 Excl. CPU (microsec):不包含內建函式 CPU 花費的時間,單位微秒 Incl. MemUse (bytes):包含內建函式所佔記憶體,單位位元組 Excl. MemUse (bytes):不包含內建函式所佔記憶體,單位位元組 Incl. PeakMemUse (bytes):包含內建函式所佔記憶體峰值,單位位元組 Excl. PeakMemUse (bytes):不包含內建函式所佔記憶體峰值,單位位元組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.