mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 13:58:24 +08:00
minor fixes of debugger.
This commit is contained in:
@@ -144,7 +144,6 @@ ul.trace {
|
|||||||
|
|
||||||
.list-group .glyphicon {
|
.list-group .glyphicon {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: -15px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td, th {
|
td, th {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
namespace yii\debug\panels;
|
namespace yii\debug\panels;
|
||||||
|
|
||||||
use yii\debug\Panel;
|
use yii\debug\Panel;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\log\Logger;
|
use yii\log\Logger;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ EOD;
|
|||||||
public function getDetail()
|
public function getDetail()
|
||||||
{
|
{
|
||||||
$timings = $this->calculateTimings();
|
$timings = $this->calculateTimings();
|
||||||
|
ArrayHelper::multisort($timings, 3, true);
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($timings as $timing) {
|
foreach ($timings as $timing) {
|
||||||
$duration = sprintf('%.1f ms', $timing[3] * 1000);
|
$duration = sprintf('%.1f ms', $timing[3] * 1000);
|
||||||
|
|||||||
@@ -47,23 +47,20 @@ EOD;
|
|||||||
$timings = array();
|
$timings = array();
|
||||||
$stack = array();
|
$stack = array();
|
||||||
foreach ($messages as $i => $log) {
|
foreach ($messages as $i => $log) {
|
||||||
list($token, $level, $category, $timestamp) = $log;
|
list($token, $level, $category, $timestamp, $traces) = $log;
|
||||||
$log[4] = $i;
|
|
||||||
if ($level == Logger::LEVEL_PROFILE_BEGIN) {
|
if ($level == Logger::LEVEL_PROFILE_BEGIN) {
|
||||||
$stack[] = $log;
|
$stack[] = $log;
|
||||||
} elseif ($level == Logger::LEVEL_PROFILE_END) {
|
} elseif ($level == Logger::LEVEL_PROFILE_END) {
|
||||||
if (($last = array_pop($stack)) !== null && $last[0] === $token) {
|
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);
|
$now = microtime(true);
|
||||||
while (($last = array_pop($stack)) !== null) {
|
while (($last = array_pop($stack)) !== null) {
|
||||||
$delta = $now - $last[3];
|
$timings[] = array(count($stack), $last[0], $last[2], $now - $last[3], $last[4]);
|
||||||
$timings[$last[4]] = array(count($stack), $last[0], $last[2], $delta);
|
|
||||||
}
|
}
|
||||||
ksort($timings);
|
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($timings as $timing) {
|
foreach ($timings as $timing) {
|
||||||
|
|||||||
Reference in New Issue
Block a user