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