/** * Generate a XHProf Display View given the various URL parameters * as arguments. The first argument is an object that implements * the iXHProfRuns interface. * * @param object $xhprof_runs_impl An object that implements * the iXHProfRuns interface *. * @param array $url_params Array of non-default URL params. * * @param string $source Category/type of the run. The source in * combination with the run id uniquely * determines a profiler run. * * @param string $run run id, or comma separated sequence of * run ids. The latter is used if an aggregate * report of the runs is desired. * * @param string $wts Comma separate list of integers. * Represents the weighted ratio in * which which a set of runs will be * aggregated. [Used only for aggregate * reports.] * * @param string $symbol Function symbol. If non-empty then the * parent/child view of this function is * displayed. If empty, a flat-profile view * of the functions is displayed. * * @param string $run1 Base run id (for diff reports) * * @param string $run2 New run id (for diff reports) * */ function displayXHProfReport($xhprof_runs_impl, $url_params, $source, $run, $wts, $symbol, $sort, $run1, $run2) { if ($run) { $runs_array = explode(",", $run); $description = ''; if (count($runs_array) == 1) { $xhprof_data = $xhprof_runs_impl->get_run($runs_array[0], $source); } else { if (!empty($wts)) { $wts_array = explode(",", $wts); } else { $wts_array = null; } $data = xhprof_aggregate_runs($xhprof_runs_impl, $runs_array, $wts_array, $source, false); $xhprof_data = $data['raw']; $description = $data['description']; } profiler_single_run_report($url_params, $xhprof_data, $description, $symbol, $sort, $run); } elseif ($run1 && $run2) { $xhprof_data1 = $xhprof_runs_impl->get_run($run1, $source, $description1); $xhprof_data2 = $xhprof_runs_impl->get_run($run2, $source, $description2); profiler_diff_report($url_params, $xhprof_data1, $description1, $xhprof_data2, $description2, $symbol, $sort, $run1, $run2); } else { echo "No XHProf runs specified in the URL."; if (method_exists($xhprof_runs_impl, 'list_runs')) { $xhprof_runs_impl->list_runs(); } } }
/** * Generate a XHProf Display View given the various URL parameters * as arguments. The first argument is an object that implements * the iXHProfRuns interface. * * @param object $xhprof_runs_impl An object that implements * the iXHProfRuns interface *. * @param array $url_params Array of non-default URL params. * * @param string $source Category/type of the run. The source in * combination with the run id uniquely * determines a profiler run. * * @param string $run run id, or comma separated sequence of * run ids. The latter is used if an aggregate * report of the runs is desired. * * @param string $wts Comma separate list of integers. * Represents the weighted ratio in * which which a set of runs will be * aggregated. [Used only for aggregate * reports.] * * @param string $symbol Function symbol. If non-empty then the * parent/child view of this function is * displayed. If empty, a flat-profile view * of the functions is displayed. * * @param string $run1 Base run id (for diff reports) * * @param string $run2 New run id (for diff reports) * */ function displayXHProfReport($xhprof_runs_impl, $url_params, $source, $run, $wts, $symbol, $sort, $run1, $run2) { if ($run) { // specific run to display? // run may be a single run or a comma separate list of runs // that'll be aggregated. If "wts" (a comma separated list // of integral weights is specified), the runs will be // aggregated in that ratio. // $runs_array = explode(",", $run); if (count($runs_array) == 1) { $xhprof_data = $xhprof_runs_impl->get_run($runs_array[0], $source, $description); } else { if (!empty($wts)) { $wts_array = explode(",", $wts); } else { $wts_array = null; } $data = xhprof_aggregate_runs($xhprof_runs_impl, $runs_array, $wts_array, $source, false); $xhprof_data = $data['raw']; $description = $data['description']; } profiler_single_run_report($url_params, $xhprof_data, $description, $symbol, $sort, $run); } else { if ($run1 && $run2) { // diff report for two runs $xhprof_data1 = $xhprof_runs_impl->get_run($run1, $source, $description1); $xhprof_data2 = $xhprof_runs_impl->get_run($run2, $source, $description2); profiler_diff_report($url_params, $xhprof_data1, $description1, $xhprof_data2, $description2, $symbol, $sort, $run1, $run2); } else { echo "No XHProf runs specified in the URL."; if (method_exists($xhprof_runs_impl, 'list_runs')) { $xhprof_runs_impl->list_runs(); } } } }
/** * Generate a XHProf Display View given the various URL parameters * as arguments. The first argument is an object that implements * the iXHProfRuns interface. * * @param object $xhprof_runs_impl An object that implements * the iXHProfRuns interface *. * @param array $url_params Array of non-default URL params. * * @param string $source Category/type of the run. The source in * combination with the run id uniquely * determines a profiler run. * * @param string $run run id, or comma separated sequence of * run ids. The latter is used if an aggregate * report of the runs is desired. * * @param string $wts Comma separate list of integers. * Represents the weighted ratio in * which which a set of runs will be * aggregated. [Used only for aggregate * reports.] * * @param string $symbol Function symbol. If non-empty then the * parent/child view of this function is * displayed. If empty, a flat-profile view * of the functions is displayed. * * @param string $run1 Base run id (for diff reports) * * @param string $run2 New run id (for diff reports) * */ function displayXHProfReport($xhprof_runs_impl, $url_params, $source, $run, $wts, $symbol, $sort, $run1, $run2) { if ($run) { // specific run to display? // run may be a single run or a comma separate list of runs // that'll be aggregated. If "wts" (a comma separated list // of integral weights is specified), the runs will be // aggregated in that ratio. // $runs_array = explode(",", $run); if (count($runs_array) == 1) { global $run_details; list($xhprof_data, $run_details) = $xhprof_runs_impl->get_run($runs_array[0], $source, $description); } else { if (!empty($wts)) { $wts_array = explode(",", $wts); } else { $wts_array = NULL; } $data = xhprof_aggregate_runs($xhprof_runs_impl, $runs_array, $wts_array, $source, FALSE); $xhprof_data = $data['raw']; $description = $data['description']; } if (!$xhprof_data) { echo "Given XHProf Run not found."; return; } profiler_single_run_report($url_params, $xhprof_data, $description, $symbol, $sort, $run, $run_details); } else { if ($run1 && $run2) { // diff report for two runs list($xhprof_data1, $run_details1) = $xhprof_runs_impl->get_run($run1, $source, $description1); list($xhprof_data2, $run_details2) = $xhprof_runs_impl->get_run($run2, $source, $description2); profiler_diff_report($url_params, $xhprof_data1, $description1, $xhprof_data2, $description2, $symbol, $sort, $run1, $run2); } else { echo "No XHProf runs specified in the URL."; } } }