/** * Show the XHProf view for the given $runIdentifier * * Note: the argument must be named "run" because XHProf_UI fetches its "run" directly * from the request variables… * * @param string $run * @return void * @throws \Sandstorm\Plumber\Exception */ public function xhprofAction($run) { require_once XHPROF_ROOT . '/classes/xhprof_ui.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/config.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/compute.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/utils.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/run.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/report/driver.php'; require_once XHPROF_ROOT . '/classes/xhprof_ui/report/single.php'; error_reporting(0); $xhprofConfiguration = new \XHProf_UI\Config(); $xhprofUi = new \XHProf_UI(array('run' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'compare' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'wts' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'fn' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'sort' => array(\XHProf_UI\Utils::STRING_PARAM, 'wt'), 'run1' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'run2' => array(\XHProf_UI\Utils::STRING_PARAM, ''), 'namespace' => array(\XHProf_UI\Utils::STRING_PARAM, 'xhprof'), 'all' => array(\XHProf_UI\Utils::UINT_PARAM, 0)), $xhprofConfiguration, FLOW_PATH_DATA . 'Logs/Profiles'); $report = $xhprofUi->generate_report(); if ($report === FALSE) { $message = 'A report could not be generated.'; $xhprofPathAndFilename = sprintf('%sLogs/Profiles/%s.xhprof', FLOW_PATH_DATA, $run); if (!file_exists($xhprofPathAndFilename)) { $message .= sprintf(' The required profile file "%s" does not exist.', $xhprofPathAndFilename); } if (!extension_loaded('xhprof')) { $message .= ' Hint: the required PHP extension "xhprof" is not loaded which might be the reason.'; } throw new Exception($message, 1360937314); } ob_start(); $report->render(); $contents = ob_get_contents(); $contents = str_replace('<tbody', '<tbody class="list"', $contents); ob_end_clean(); $this->view->assign('contents', $contents); $this->view->assign('run', $run); }
* 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) * */ $xhprof_config = new XHProf_UI\Config(); $xhprof_ui = new XHProf_UI(array('run' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'compare' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'wts' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'fn' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'sort' => array(XHProf_UI\Utils::STRING_PARAM, 'wt'), 'run1' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'run2' => array(XHProf_UI\Utils::STRING_PARAM, ''), 'namespace' => array(XHProf_UI\Utils::STRING_PARAM, 'xhprof'), 'all' => array(XHProf_UI\Utils::UINT_PARAM, 0)), $xhprof_config); if (!($xhprof_report = $xhprof_ui->generate_report())) { echo "No XHProf runs specified in the URL."; XHProf_UI\Utils::list_runs($xhprof_ui->dir); } $xhprof_report->render(); } include XHPROF_ROOT . '/views/footer.php';