XHProfRuns_Default::getRunComparativeData PHP Méthode

getRunComparativeData() public méthode

Get comparative information for a given URL and c_url, this information will be used to display stats like how many calls a URL has, average, min, max execution time, etc. This information is pushed into the global namespace, which is horribly hacky.
public getRunComparativeData ( string $url, string $c_url ) : array
$url string
$c_url string
Résultat array
    public function getRunComparativeData($url, $c_url)
    {
        $url = $this->db->escape($url);
        $c_url = $this->db->escape($c_url);
        //Runs same URL
        //  count, avg/min/max for wt, cpu, pmu
        $query = "SELECT count(`id`), avg(`wt`), min(`wt`), max(`wt`),  avg(`cpu`), min(`cpu`), max(`cpu`), avg(`pmu`), min(`pmu`), max(`pmu`) FROM `details` WHERE `url` = '{$url}'";
        $rs = $this->db->query($query);
        $row = $this->db->getNextAssoc($rs);
        $row['url'] = $url;
        $row['95(`wt`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'wt', 'type' => 'url', 'url' => $url));
        $row['95(`cpu`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'cpu', 'type' => 'url', 'url' => $url));
        $row['95(`pmu`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'pmu', 'type' => 'url', 'url' => $url));
        global $comparative;
        $comparative['url'] = $row;
        unset($row);
        //Runs same c_url
        //  count, avg/min/max for wt, cpu, pmu
        $query = "SELECT count(`id`), avg(`wt`), min(`wt`), max(`wt`),  avg(`cpu`), min(`cpu`), max(`cpu`), avg(`pmu`), min(`pmu`), max(`pmu`) FROM `details` WHERE `c_url` = '{$c_url}'";
        $rs = $this->db->query($query);
        $row = $this->db->getNextAssoc($rs);
        $row['url'] = $c_url;
        $row['95(`wt`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'wt', 'type' => 'c_url', 'url' => $c_url));
        $row['95(`cpu`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'cpu', 'type' => 'c_url', 'url' => $c_url));
        $row['95(`pmu`)'] = $this->calculatePercentile(array('count' => $row['count(`id`)'], 'column' => 'pmu', 'type' => 'c_url', 'url' => $c_url));
        $comparative['c_url'] = $row;
        unset($row);
        return $comparative;
    }