public function indexAction() { // param name, its type, and default value $params = array('run' => array(XHPROF_STRING_PARAM, ''), 'wts' => array(XHPROF_STRING_PARAM, ''), 'symbol' => array(XHPROF_STRING_PARAM, ''), 'sort' => array(XHPROF_STRING_PARAM, 'wt'), 'run1' => array(XHPROF_STRING_PARAM, ''), 'run2' => array(XHPROF_STRING_PARAM, ''), 'source' => array(XHPROF_STRING_PARAM, 'xhprof'), 'all' => array(XHPROF_UINT_PARAM, 0), 'source2' => array(XHPROF_STRING_PARAM, 'xhprof')); // pull values of these params, and create named globals for each param xhprof_param_init($params); global $run, $wts, $symbol, $sort, $run1, $run2, $source, $all, $source2, $sort_col; /* reset params to be a array of variable names to values by the end of this page, param should only contain values that need to be preserved for the next page. unset all unwanted keys in $params. */ foreach ($params as $k => $v) { $params[$k] = ${$k}; // unset key from params that are using default values. So URLs aren't // ridiculously long. if ($params[$k] == $v[1]) { unset($params[$k]); } } $sort_col = $this->getParam('sort'); $params['dir'] = $this->storage->getCurrentDirectory(); $params['list_url'] = $this->getParam('list_url'); $GLOBALS['run_page_params'] = $params; $runData = $this->storage->getRunMetaData($run); $xhprofData = $this->storage->getRunXHProfData($run); RunTemplate::render($runData, $params, $xhprofData, $symbol); }
public static function graph($run) { require_once LIB . "xhprof/xhprof_lib/display/xhprof.php"; require_once LIB . "xhprof/xhprof_lib/utils/xhprof_runs.php"; ini_set('max_execution_time', 100); ini_set('display_errors', "Off"); error_reporting(0); $source = SITE; $params = array('run' => array(XHPROF_STRING_PARAM, $run), 'source' => array(XHPROF_STRING_PARAM, $source), 'func' => array(XHPROF_STRING_PARAM, ''), 'type' => array(XHPROF_STRING_PARAM, 'png'), 'threshold' => array(XHPROF_FLOAT_PARAM, 0.01), 'critical' => array(XHPROF_BOOL_PARAM, true), 'run1' => array(XHPROF_STRING_PARAM, ''), 'run2' => array(XHPROF_STRING_PARAM, '')); // pull values of these params, and create named globals for each param xhprof_param_init($params); // if invalid value specified for threshold, then use the default $threshold = 0.01; $type = 'png'; $xhprof_runs_impl = new \XHProfRuns_Default(self::logpath()); // single run call graph image generation // xhprof_render_image( $xhprof_runs_impl, $run, $type,$threshold, $func, $source, $critical ); xhprof_render_image($xhprof_runs_impl, $run, $type, $threshold, $func, $source, $critical); }
public function indexAction() { ini_set('max_execution_time', 100); $params = array('run' => array(XHPROF_STRING_PARAM, ''), 'source' => array(XHPROF_STRING_PARAM, 'xhprof'), 'func' => array(XHPROF_STRING_PARAM, ''), 'type' => array(XHPROF_STRING_PARAM, 'png'), 'threshold' => array(XHPROF_FLOAT_PARAM, 0.01), 'critical' => array(XHPROF_BOOL_PARAM, true), 'run1' => array(XHPROF_STRING_PARAM, ''), 'run2' => array(XHPROF_STRING_PARAM, '')); // pull values of these params, and create named globals for each param xhprof_param_init($params); global $run, $source, $func, $type, $threshold, $critical, $run1, $run2, $xhprof_legal_image_types; // if invalid value specified for threshold, then use the default if ($threshold < 0 || $threshold > 1) { $threshold = $params['threshold'][1]; } // if invalid value specified for type, use the default if (!array_key_exists($type, $xhprof_legal_image_types)) { $type = $params['type'][1]; // default image type. } if (!empty($run)) { // single run call graph image generation xhprof_render_image($this->storage, $run, $type, $threshold, $func, $source, $critical); } }
* used for viewing results of XHProf runs from a * browser. * * Modification History: * 02/15/2008 - cjiang - The first version of callgraph visualizer * based on Graphviz's DOT tool. * * @author Changhao Jiang (cjiang@facebook.com) */ // by default assume that xhprof_html & xhprof_lib directories // are at the same level. $GLOBALS['XHPROF_LIB_ROOT'] = $_SERVER['DOCUMENT_ROOT'] . '/../application/library/xhprof_lib'; ini_set('max_execution_time', 100); $params = array('run' => array(XHPROF_STRING_PARAM, ''), 'source' => array(XHPROF_STRING_PARAM, 'xhprof'), 'func' => array(XHPROF_STRING_PARAM, ''), 'type' => array(XHPROF_STRING_PARAM, 'png'), 'threshold' => array(XHPROF_FLOAT_PARAM, 0.01), 'critical' => array(XHPROF_BOOL_PARAM, true), 'run1' => array(XHPROF_STRING_PARAM, ''), 'run2' => array(XHPROF_STRING_PARAM, '')); // pull values of these params, and create named globals for each param xhprof_param_init($params); // if invalid value specified for threshold, then use the default if ($threshold < 0 || $threshold > 1) { $threshold = $params['threshold'][1]; } // if invalid value specified for type, use the default if (!array_key_exists($type, $xhprof_legal_image_types)) { $type = $params['type'][1]; // default image type. } $xhprof_runs_impl = new XHProfRuns_Default(); if (!empty($run)) { // single run call graph image generation xhprof_render_image($xhprof_runs_impl, $run, $type, $threshold, $func, $source, $critical); } else { // diff report call graph image generation