首页 > 代码库 > xhprof代码添加分析性能

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="http://www.mamicode.com/‘.$profile_url.‘" target="_blank">性能链接</a>‘;

 

xhprof代码添加分析性能