PHP函數級分層效能分析工具xhprof的安裝和使用方法

來源:互聯網
上載者:User
1. 下載安裝xhprof

$ wget http://pecl.php.net/get/xhprof-0.9.4.tgz$  tar zxvf xhprof-0.9.4.tgz$  cd xhprof-0.9.4/extension/$  phpize$  ./configure $  make$  sudo make install

2. 配置 php.ini

[xhprof]extension=xhprof.so;xhprof.output_dir=/tmp/xhprof

重啟php-fpm

$ service php-fpm restart

3. 使用方法

save_run($data, "xhprof");var_dump($run_id);

4. 頁面展示說明

將xhprof_lib&&xhprof_html相關目錄copy到可以訪問到的地址訪問 xxx/xhprof_html/index.php?run=$run_id&source=xhprof 就可經看到你的php代碼啟動並執行相關情況下面是一些參數說明Inclusive Time                 包括子函數所有執行時間。Exclusive Time/Self Time       函數執行本身花費的時間,不包括子樹執行時間。Wall Time                      花去了的時間或掛鐘時間。CPU Time                       使用者耗的時間+核心耗的時間Inclusive CPU                  包括子函數一起所佔用的CPUExclusive CPU                  函數自身所佔用的CPU
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.