xhprof php性能分析工具

php7 沒有官方版php

下載地址git clone https://github.com/longxinH/xhprofhtml

cd xhprof/extension/ 進入目錄指定phpconfig地址進行安裝git

extension=xhprof.sogithub

xhprof.output_dir=/tmpphp7

安裝包中xhprof_html和xhprof_lib移動至項目目錄ui

//開始位置
xhprof_enable();

//結束位置
$xhprofData = xhprof_disable();
require 'xhprof_lib/utils/xhprof_lib.php';
require 'xhprof_lib/utils/xhprof_runs.php';
$xhprofRuns = new XHProfRuns_Default();
$runId = $xhprofRuns->save_run($xhprofData, 'xhprof_test');
$returnData['runid'] = $runId;

根據runid打開路徑 code

http://xxx/index.php?run=5d357b6f43787&source=xhprof_testhtm

效果圖(圖形化須要安裝graphviz)blog