Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function getRunXHprofMatchingFunctions($run, $q)
 {
     $rawData = $this->getRunXHProfData($run);
     $functions = xhprof_get_matching_functions($q, $rawData);
     // If exact match is present move it to the front
     if (isset($functions[$q])) {
         $old_functions = $functions;
         $functions = array($q => $old_functions[$q]);
         foreach ($old_functions as $f => $info) {
             // exact match case has already been added to the front
             if ($f != $q) {
                 $functions[$f] = $info;
             }
         }
     }
     $functions = array_slice($functions, 0, 15);
     return array_values($functions);
 }
Exemplo n.º 2
0
include_once $GLOBALS['XHPROF_LIB_ROOT'] . '/utils/xhprof_lib.php';
// param name, its type, and default value
$params = array('q' => array(XHPROF_STRING_PARAM, ''), 'run' => array(XHPROF_STRING_PARAM, ''), 'run1' => array(XHPROF_STRING_PARAM, ''), 'run2' => array(XHPROF_STRING_PARAM, ''), 'source' => array(XHPROF_STRING_PARAM, 'xhprof'));
// pull values of these params, and create named globals for each param
xhprof_param_init($params);
if (!empty($run)) {
    // single run mode
    $raw_data = $xhprof_runs_impl->get_run($run, $source, $desc_unused);
    $functions = xhprof_get_matching_functions($q, $raw_data);
} else {
    if (!empty($run1) && !empty($run2)) {
        // diff mode
        $raw_data = $xhprof_runs_impl->get_run($run1, $source, $desc_unused);
        $functions1 = xhprof_get_matching_functions($q, $raw_data);
        $raw_data = $xhprof_runs_impl->get_run($run2, $source, $desc_unused);
        $functions2 = xhprof_get_matching_functions($q, $raw_data);
        $functions = array_unique(array_merge($functions1, $functions2));
        asort($functions);
    } else {
        xhprof_error("no valid runs specified to typeahead endpoint");
        $functions = array();
    }
}
// If exact match is present move it to the front
if (in_array($q, $functions)) {
    $old_functions = $functions;
    $functions = array($q);
    foreach ($old_functions as $f) {
        // exact match case has already been added to the front
        if ($f != $q) {
            $functions[] = $f;