From 89c61c9cb4745a42597e5666d8134d54a538e31f Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 25 Aug 2013 12:50:43 -0400 Subject: [PATCH] minor fixes of debugger. --- framework/yii/debug/assets/main.css | 1 - framework/yii/debug/panels/DbPanel.php | 2 ++ framework/yii/debug/panels/ProfilingPanel.php | 9 +++------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/framework/yii/debug/assets/main.css b/framework/yii/debug/assets/main.css index 9aaec70..259256f 100644 --- a/framework/yii/debug/assets/main.css +++ b/framework/yii/debug/assets/main.css @@ -144,7 +144,6 @@ ul.trace { .list-group .glyphicon { float: right; - margin-right: -15px; } td, th { diff --git a/framework/yii/debug/panels/DbPanel.php b/framework/yii/debug/panels/DbPanel.php index 3da55f0..8dd2c9e 100644 --- a/framework/yii/debug/panels/DbPanel.php +++ b/framework/yii/debug/panels/DbPanel.php @@ -8,6 +8,7 @@ namespace yii\debug\panels; use yii\debug\Panel; +use yii\helpers\ArrayHelper; use yii\log\Logger; use yii\helpers\Html; @@ -47,6 +48,7 @@ EOD; public function getDetail() { $timings = $this->calculateTimings(); + ArrayHelper::multisort($timings, 3, true); $rows = array(); foreach ($timings as $timing) { $duration = sprintf('%.1f ms', $timing[3] * 1000); diff --git a/framework/yii/debug/panels/ProfilingPanel.php b/framework/yii/debug/panels/ProfilingPanel.php index ca9d070..c462e40 100644 --- a/framework/yii/debug/panels/ProfilingPanel.php +++ b/framework/yii/debug/panels/ProfilingPanel.php @@ -47,23 +47,20 @@ EOD; $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) {