Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Add query param 'profilerFiveSlowest'
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrauer committed Mar 12, 2016
1 parent 059cdd5 commit b7e219a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ function cmp($a, $b) {
return ($a['time_seconds'] < $b['time_seconds']) ? 1 : -1;
}
uasort($queryTimes, 'cmp');
Zend_Registry::get('logger')->info(print_r($queryCounts, true));
Zend_Registry::get('logger')->info(print_r($queryTimes, true));

if (array_key_exists('profilerFiveSlowest', $_GET)) {
// Logs much less info, only the five slowest queries.
$fiveSlowest = array();
$count = 0;
foreach($queryTimes as $query => $time) {
$fiveSlowest[$query] = $time;
if ($count++ == 4) { break; }
}
Zend_Registry::get('logger')->info(print_r($fiveSlowest, true));
} else {
Zend_Registry::get('logger')->info(print_r($queryCounts, true));
Zend_Registry::get('logger')->info(print_r($queryTimes, true));
}
}

0 comments on commit b7e219a

Please sign in to comment.