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
e3308996
Commit
e3308996
authored
Jul 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added call stack display for DB debug panel.
parent
915a3cd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
DbPanel.php
framework/yii/debug/panels/DbPanel.php
+13
-4
No files found.
framework/yii/debug/panels/DbPanel.php
View file @
e3308996
...
...
@@ -51,7 +51,16 @@ EOD;
$rows
=
array
();
foreach
(
$timings
as
$timing
)
{
$duration
=
sprintf
(
'%.1f ms'
,
$timing
[
3
]
*
1000
);
$procedure
=
str_repeat
(
'<span class="indent">→</span>'
,
$timing
[
0
])
.
Html
::
encode
(
$timing
[
1
]);
$procedure
=
Html
::
encode
(
$timing
[
1
]);
$traces
=
$timing
[
4
];
if
(
!
empty
(
$traces
))
{
$procedure
.=
Html
::
ul
(
$traces
,
array
(
'class'
=>
'trace'
,
'item'
=>
function
(
$trace
)
{
return
"<li>
{
$trace
[
'file'
]
}
(
{
$trace
[
'line'
]
}
)</li>"
;
},
));
}
$rows
[]
=
"<tr><td style=
\"
width: 80px;
\"
>
$duration
</td><td>
$procedure
</td>"
;
}
$rows
=
implode
(
"
\n
"
,
$rows
);
...
...
@@ -85,12 +94,12 @@ EOD;
$stack
=
array
();
foreach
(
$messages
as
$i
=>
$log
)
{
list
(
$token
,
$level
,
$category
,
$timestamp
)
=
$log
;
$log
[
4
]
=
$i
;
$log
[
5
]
=
$i
;
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
,
$last
[
3
],
$timestamp
-
$last
[
3
]);
$timings
[
$last
[
5
]]
=
array
(
count
(
$stack
),
$token
,
$last
[
3
],
$timestamp
-
$last
[
3
],
$last
[
4
]);
}
}
}
...
...
@@ -98,7 +107,7 @@ EOD;
$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
[
$last
[
5
]]
=
array
(
count
(
$stack
),
$last
[
0
],
$last
[
2
],
$delta
,
$last
[
4
]
);
}
ksort
(
$timings
);
return
$this
->
_timings
=
$timings
;
...
...
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