php7 没有官方版
下载地址git clone https://github.com/longxinH/xhprof
cd xhprof/extension/ 进入目录指定phpconfig地址进行安装
extension=xhprof.so
xhprof.output_dir=/tmp
安装包中xhprof_html和xhprof_lib移动至项目目录
//开始位置
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打开路径
http://xxx/index.php?run=5d357b6f43787&source=xhprof_test
效果图(图形化需要安装graphviz)