Esempio n. 1
0
 *
 * 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);
}
Esempio n. 2
0
 *
 * @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();