xhprof代码添加分析性能

<?php
xhprof_enable(
    XHPROF_FLAGS_MEMORY,
    [
        'ignored_functions'    => [
            //'call_user_func',
            //'call_user_func_array'
        ]
    ]
);


//逻辑代码
//......

$xhprofData = xhprof_disable();// $xhprofData是数组形式的分析结果

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');

$profile_url = 'http://10.10.20.3/xhprof_html/index.php?run=' . $runId . '&source=xhprof_test';
echo '<a href="'.$profile_url.'" target="_blank">性能链接</a>';

 

posted on 2017-05-03 15:33  dongruiha  阅读(240)  评论(0编辑  收藏  举报

导航