Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
b42f5181
Commit
b42f5181
authored
Jul 26, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganized debug panels.
parent
6e851e95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
ProfilingPanel.php
framework/yii/debug/panels/ProfilingPanel.php
+24
-1
RequestPanel.php
framework/yii/debug/panels/RequestPanel.php
+0
-23
No files found.
framework/yii/debug/panels/ProfilingPanel.php
View file @
b42f5181
...
...
@@ -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
<<<EOD
<div class="yii-debug-toolbar-block">
<a href="$url" title="total processing time">Time: <span class="label">$time</span></a>
</div>
<div class="yii-debug-toolbar-block">
<a href="$url" title="peak memory consumption">Memory: <span class="label">$memory</span></a>
</div>
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
<<<EOD
<h1>Performance Profiling</h1>
<h2>Performance Profiling</h2>
<p>Total processing time: <b>$time</b>; Peak memory: <b>$memory</b>.</p>
<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
<thead>
...
...
@@ -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
,
);
}
...
...
framework/yii/debug/panels/RequestPanel.php
View file @
b42f5181
...
...
@@ -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
<<<EOD
<div class="yii-debug-toolbar-block">
<a href="$url">Memory: <span class="label">$memory</span></a>
</div>
<div class="yii-debug-toolbar-block">
<a href="$url">Time: <span class="label">$time</span></a>
</div>
<div class="yii-debug-toolbar-block">
<a href="$url">Action: <span class="label">{$this->data['action']}</span></a>
</div>
EOD;
...
...
@@ -81,17 +71,6 @@ EOD;
),
),
));
return
"<h1>Request Information</h1>
\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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment