Ejemplo n.º 1
0
function showChart($rs, $flip = false)
{
    $dataPoints = "";
    $ids = array();
    $arCPU = array();
    $arWT = array();
    $arPEAK = array();
    $arIDS = array();
    $arDateIDs = array();
    while ($row = XHProfRuns_DefaultXHPROFGUI::getNextAssoc($rs)) {
        $date[] = "'" . date("Y-m-d", $row['timestamp']) . "'";
        $arCPU[] = $row['cpu'];
        $arWT[] = $row['wt'];
        $arPEAK[] = $row['pmu'];
        $arIDS[] = $row['id'];
        $arDateIDs[] = "'" . date("Y-m-d", $row['timestamp']) . " <br/> " . $row['id'] . "'";
    }
    $date = $flip ? array_reverse($date) : $date;
    $arCPU = $flip ? array_reverse($arCPU) : $arCPU;
    $arWT = $flip ? array_reverse($arWT) : $arWT;
    $arPEAK = $flip ? array_reverse($arPEAK) : $arPEAK;
    $arIDS = $flip ? array_reverse($arIDS) : $arIDS;
    $arDateIDs = $flip ? array_reverse($arDateIDs) : $arDateIDs;
    $dateJS = implode(", ", $date);
    $cpuJS = implode(", ", $arCPU);
    $wtJS = implode(", ", $arWT);
    $pmuJS = implode(", ", $arPEAK);
    $idsJS = implode(", ", $arIDS);
    $dateidsJS = implode(", ", $arDateIDs);
    ob_start();
    require "../xhprof_lib/templates/chart.phtml";
    $stuff = ob_get_contents();
    ob_end_clean();
    return array($stuff, "<div id=\"container\" style=\"width: 1000px; height: 500px; margin: 0 auto\"></div>");
}
Ejemplo n.º 2
0
 $last = (int) $last;
 $days = isset($_GET['days']) ? $_GET['days'] : 1;
 $days = (int) $days;
 if (isset($_GET['type']) && ($_GET['type'] === 'url' or $_GET['type'] = 'curl')) {
     $type = $_GET['type'];
 } else {
     $type = 'url';
 }
 $criteria['limit'] = $last;
 $criteria['days'] = $days;
 $criteria['type'] = $type;
 $resultSet = $xhprof_runs_impl->getHardHit($criteria);
 echo "<div class=\"runTitle\">Hardest Hit</div>\n";
 echo "<table id=\"box-table-a\" class=\"tablesorter\" summary=\"Stats\"><thead><tr><th>URL</th><th>Hits</th><th class=\"{sorter: 'numeric'}\">Total Wall Time</th><th>Avg Wall Time</th></tr></thead>";
 echo "<tbody>\n";
 while ($row = XHProfRuns_DefaultXHPROFGUI::getNextAssoc($resultSet)) {
     $url = urlencode($row['url']);
     $html['url'] = htmlentities($row['url'], ENT_QUOTES, 'UTF-8');
     echo "\t<tr><td><a href=\"?geturl={$url}\">{$html['url']}</a></td><td>{$row['count']}</td><td>" . number_format($row['total_wall']) . " ms</td><td>" . number_format($row['avg_wall']) . " ms</td></tr>\n";
 }
 echo "</tbody>\n";
 echo "</table>\n";
 echo <<<CODESE
 <script type="text/javascript">
 \$(document).ready(function() { 
   \$.tablesorter.addParser({ 
 id: 'pretty', 
 is: function(s) { 
     return false; 
 }, 
 format: function(s) {