Skip to content

Commit

Permalink
minor fixes of debugger.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed Aug 25, 2013
1 parent c037b48 commit 89c61c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion framework/yii/debug/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ ul.trace {

.list-group .glyphicon {
float: right;
margin-right: -15px;
}

td, th {
Expand Down
2 changes: 2 additions & 0 deletions framework/yii/debug/panels/DbPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace yii\debug\panels;

use yii\debug\Panel;
use yii\helpers\ArrayHelper;
use yii\log\Logger;
use yii\helpers\Html;

Expand Down Expand Up @@ -47,6 +48,7 @@ public function getSummary()
public function getDetail()
{
$timings = $this->calculateTimings();
ArrayHelper::multisort($timings, 3, true);
$rows = array();
foreach ($timings as $timing) {
$duration = sprintf('%.1f ms', $timing[3] * 1000);
Expand Down
9 changes: 3 additions & 6 deletions framework/yii/debug/panels/ProfilingPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,20 @@ public function getDetail()
$timings = array();
$stack = array();
foreach ($messages as $i => $log) {
list($token, $level, $category, $timestamp) = $log;
$log[4] = $i;
list($token, $level, $category, $timestamp, $traces) = $log;
if ($level == Logger::LEVEL_PROFILE_BEGIN) {
$stack[] = $log;
} elseif ($level == Logger::LEVEL_PROFILE_END) {
if (($last = array_pop($stack)) !== null && $last[0] === $token) {
$timings[$last[4]] = array(count($stack), $token, $category, $timestamp - $last[3]);
$timings[] = array(count($stack), $token, $category, $timestamp - $last[3], $traces);
}
}
}

$now = microtime(true);
while (($last = array_pop($stack)) !== null) {
$delta = $now - $last[3];
$timings[$last[4]] = array(count($stack), $last[0], $last[2], $delta);
$timings[] = array(count($stack), $last[0], $last[2], $now - $last[3], $last[4]);
}
ksort($timings);

$rows = array();
foreach ($timings as $timing) {
Expand Down

0 comments on commit 89c61c9

Please sign in to comment.