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); } }
* * 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 xhprof_render_diff_image($xhprof_runs_impl, $run1, $run2, $type, $threshold, $source); }
* * @author Changhao Jiang (cjiang@facebook.com) */ $ini = eZINI::instance('ezperformancelogger.ini'); $GLOBALS['dotcmd'] = $ini->variable('XHProfSettings', 'DotCommand'); // by default assume that xhprof_html & xhprof_lib directories // are at the same level. $GLOBALS['XHPROF_LIB_ROOT'] = __DIR__ . '/../../lib/xhprof'; include_once $GLOBALS['XHPROF_LIB_ROOT'] . '/display/xhprof.php'; 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 ($GLOBALS['threshold'] < 0 || $GLOBALS['threshold'] > 1) { $GLOBALS['threshold'] = $params['threshold'][1]; } // if invalid value specified for type, use the default if (!array_key_exists($GLOBALS['type'], $xhprof_legal_image_types)) { $GLOBALS['type'] = $params['type'][1]; // default image type. } $xhprof_runs_impl = new XHProfRuns_Default(eZXHProfLogger::logDir()); if (!empty($GLOBALS['run'])) { // single run call graph image generation xhprof_render_image($xhprof_runs_impl, $GLOBALS['run'], $GLOBALS['type'], $GLOBALS['threshold'], $GLOBALS['func'], $GLOBALS['source'], $GLOBALS['critical']); } else { // diff report call graph image generation xhprof_render_diff_image($xhprof_runs_impl, $GLOBALS['run1'], $GLOBALS['run2'], $GLOBALS['type'], $GLOBALS['threshold'], $GLOBALS['source']); } eZExecution::cleanExit();
// Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** * * A callgraph generator for XHProf. * * * This file is part of the UI/reporting component, * 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'] = dirname(__FILE__) . '/xhprof_lib'; include_once $GLOBALS['XHPROF_LIB_ROOT'] . '/utils/callgraph_utils.php'; include_once $GLOBALS['XHPROF_LIB_ROOT'] . '/utils/xhprof_runs.php'; ini_set('max_execution_time', 100); $xhprof_runs_impl = new XHProfRuns_Default(); print_r($source); print_r($id); xhprof_render_image($xhprof_runs_impl, $id, 'jpg', 0.5, NULL, $source, FALSE);