diff --git a/framework/yii/debug/panels/ProfilingPanel.php b/framework/yii/debug/panels/ProfilingPanel.php index 0d3ac9d..5bd32ee 100644 --- a/framework/yii/debug/panels/ProfilingPanel.php +++ b/framework/yii/debug/panels/ProfilingPanel.php @@ -25,6 +25,22 @@ class ProfilingPanel extends Panel return 'Profiling'; } + public function getSummary() + { + $memory = sprintf('%.1f MB', $this->data['memory'] / 1048576); + $time = number_format($this->data['time'] * 1000) . ' ms'; + $url = $this->getUrl(); + + return << + Time: $time + +
+ Memory: $memory +
+EOD; + } + public function getDetail() { $messages = $this->data['messages']; @@ -58,8 +74,13 @@ class ProfilingPanel extends Panel } $rows = implode("\n", $rows); + $memory = sprintf('%.1f MB', $this->data['memory'] / 1048576); + $time = number_format($this->data['time'] * 1000) . ' ms'; + return <<Performance Profiling +

Performance Profiling

+ +

Total processing time: $time; Peak memory: $memory.

@@ -81,6 +102,8 @@ EOD; $target = $this->module->logTarget; $messages = $target->filterMessages($target->messages, Logger::LEVEL_PROFILE); return array( + 'memory' => memory_get_peak_usage(), + 'time' => microtime(true) - YII_BEGIN_TIME, 'messages' => $messages, ); } diff --git a/framework/yii/debug/panels/RequestPanel.php b/framework/yii/debug/panels/RequestPanel.php index f60e58e..e709de6 100644 --- a/framework/yii/debug/panels/RequestPanel.php +++ b/framework/yii/debug/panels/RequestPanel.php @@ -28,20 +28,10 @@ class RequestPanel extends Panel public function getSummary() { - $memory = sprintf('%.1f MB', $this->data['memory'] / 1048576); - $time = number_format($this->data['time'] * 1000) . ' ms'; $url = $this->getUrl(); return << - Memory: $memory - - - - - EOD; @@ -81,17 +71,6 @@ EOD; ), ), )); - return "

Request Information

\n" - . $this->renderData('Routing', $data) . "\n" - . $this->renderData('Flashes', $this->data['flashes']) . "\n" - . $this->renderData('$_GET', $this->data['GET']) . "\n" - . $this->renderData('$_POST', $this->data['POST']) . "\n" - . $this->renderData('$_COOKIE', $this->data['COOKIE']) . "\n" - . $this->renderData('$_FILES', $this->data['FILES']) . "\n" - . $this->renderData('$_SESSION', $this->data['SESSION']) . "\n" - . $this->renderData('$_SERVER', $this->data['SERVER']) . "\n" - . $this->renderData('Request Headers', $this->data['requestHeaders']) . "\n" - . $this->renderData('Response Headers', $this->data['responseHeaders']); } public function save() @@ -133,8 +112,6 @@ EOD; /** @var \yii\web\Session $session */ $session = Yii::$app->getComponent('session', false); return array( - 'memory' => memory_get_peak_usage(), - 'time' => microtime(true) - YII_BEGIN_TIME, 'flashes' => $session ? $session->getAllFlashes() : array(), 'requestHeaders' => $requestHeaders, 'responseHeaders' => $responseHeaders,