\t s = s.replace(/ ms/g,""); \t return s.replace(/,/g,""); \t }, \t // set type, either numeric or text \t type: 'numeric' }); \$(function() { \t \$("table").tablesorter({ \t headers: { \t\t 2: { \t\t sorter:'pretty' \t\t }, \t\t 3: { \t\t sorter:'pretty' \t\t } \t } \t }); }); }); </script> CODESE; } else { include "../lib/templates/header.phtml"; $last = isset($_GET['last']) ? $_GET['last'] : 25; $last = (int) $last; $criteria['order by'] = "timestamp"; $criteria['limit'] = $last; $rs = $xhprof_runs_impl->getRuns($criteria); displayRuns($rs, "Last {$last} Runs"); } include "../lib/templates/footer.phtml";
// set type, either numeric or text type: 'numeric' }); $(function() { $("table").tablesorter({ headers: { 2: { sorter:'pretty' }, 3: { sorter:'pretty' } } }); }); }); </script> CODESE; }else { include ("../xhprof_lib/templates/header.phtml"); $last = (isset($_GET['last'])) ? $_GET['last'] : 25; $last = (int) $last; $criteria['order by'] = "timestamp"; $criteria['limit'] = $last; $rs = $xhprof_runs_impl->getRuns($criteria); displayRuns($rs, "Last $last Runs"); } include ("../xhprof_lib/templates/footer.phtml");
\t }, \t // set type, either numeric or text \t type: 'numeric' }); \$(function() { \t \$("table").tablesorter({ \t headers: { \t\t 2: { \t\t sorter:'pretty' \t\t }, \t\t 3: { \t\t sorter:'pretty' \t\t } \t } \t }); }); }); </script> CODESE; } else { include XHPROF_LIB_ROOT . "/templates/header.phtml"; $last = isset($_GET['last']) && !empty($_GET['last']) ? $_GET['last'] : 25; if ($last != 'all') { $last = (int) $last; $criteria['limit'] = $last; } $criteria['order by'] = "timestamp"; $rs = $xhprof_runs_impl->getRuns($criteria); displayRuns($rs, ($last == 'all' ? 'All' : "Last " . $last) . " Runs"); } include XHPROF_LIB_ROOT . "/templates/footer.phtml";
displayRuns($rs, "Last {$last} Runs"); } elseif (isset($_GET['getruns'])) { $days = (int) $_GET['days']; switch ($_GET['getruns']) { case "cpu": $load = "cpu"; break; case "wt": $load = "wt"; break; case "pmu": $load = "pmu"; break; } $rs = $xhprof_runs_impl->getRuns(array("order by" => $load, 'limit' => 500, 'where' => "DATE_SUB(CURDATE(), INTERVAL {$days} DAY) <= `timestamp`")); displayRuns($rs, "Worst runs by {$load}"); } else { displayXHProfReport($xhprof_runs_impl, $params, $source, $run, $wts, $symbol, $sort, $run1, $run2); } function displayRuns($resultSet, $title = "") { echo "<div class=\"runTitle\">{$title}</div>\n"; echo "<table id=\"box-table-a\" class=\"tablesorter\" summary=\"Stats\"><thead><tr><th>Timestamp</th><th>Cpu</th><th>Wall Time</th><th>Peak Memory Usage</th><th>URL</th><th>Simplified URL</th></tr></thead>"; echo "<tbody>\n"; while ($row = mysql_fetch_assoc($resultSet)) { $c_url = urlencode($row['c_url']); $url = urlencode($row['url']); $date = strtotime($row['timestamp']); $date = date('M d H:i:s', $date); echo "\t<tr><td><a href=\"/?run={$row['id']}\">{$date}</a><br><span class=\"runid\">{$row['id']}</span></td><td>{$row['cpu']}</td><td>{$row['wt']}</td><td>{$row['pmu']}</td><td><a href=\"?geturl={$url}\">{$row['url']}</a></td><td><a href=\"?getcurl={$c_url}\">{$row['c_url']}</a></td></tr>\n"; }