コード例 #1
0
ファイル: view.php プロジェクト: gggeek/ezperformancelogger
        unset($params[$k]);
    }
}
////echo "<html>";
////echo "<head><title>XHProf: Hierarchical Profiler Report</title>";
////xhprof_include_js_css();
////echo "</head>";
////echo "<body>";
$vbar = ' class="vbar"';
$vwbar = ' class="vwbar"';
$vwlbar = ' class="vwlbar"';
$vbbar = ' class="vbbar"';
$vrbar = ' class="vrbar"';
$vgbar = ' class="vgbar"';
$xhprof_runs_impl = new XHProfRuns_Default(eZXHProfLogger::logDir());
displayXHProfReport($xhprof_runs_impl, $params, $GLOBALS['source'], $GLOBALS['run'], $GLOBALS['wts'], $GLOBALS['symbol'], $GLOBALS['sort'], $GLOBALS['run1'], $GLOBALS['run2']);
////echo "</body>";
////echo "</html>";
$body = ob_get_clean();
$info = false;
$infoFile = eZXHProfLogger::logDir() . "/{$GLOBALS['run']}.info";
if (file_exists($infoFile)) {
    $info = eZPerfLoggerApacheLogger::parseLogLine(file_get_contents($infoFile));
}
$tpl = eZTemplate::factory();
$tpl->setVariable('body', $body);
$tpl->setVariable('error', $error);
$tpl->setVariable('run', $GLOBALS['run']);
$tpl->setVariable('info', $info);
$Result['content'] = $tpl->fetch('design:xhprof/view.tpl');
$Result['path'] = array(array('text' => 'XHProf', 'url' => 'xhprof/list'), array('text' => 'Run: ' . $GLOBALS['run'], 'url' => 'xhprof/view?run=' . $GLOBALS['run']));
コード例 #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();