Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93568027
DarkConsoleXHProfPlugin.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 29, 19:37
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 19:37 (2 d)
Engine
blob
Format
Raw Data
Handle
22664622
Attached To
rPH Phabricator
DarkConsoleXHProfPlugin.php
View Options
<?php
/**
* @group console
*/
final
class
DarkConsoleXHProfPlugin
extends
DarkConsolePlugin
{
protected
$xhprofID
;
public
function
getName
()
{
$run
=
$this
->
getData
();
if
(
$run
)
{
return
'<span style="color: #ff00ff;">•</span> XHProf'
;
}
return
'XHProf'
;
}
public
function
getDescription
()
{
return
'Provides detailed PHP profiling information through XHProf.'
;
}
public
function
generateData
()
{
return
$this
->
xhprofID
;
}
public
function
getXHProfRunID
()
{
return
$this
->
xhprofID
;
}
public
function
render
()
{
if
(!
DarkConsoleXHProfPluginAPI
::
isProfilerAvailable
())
{
$href
=
PhabricatorEnv
::
getDoclink
(
'article/Installation_Guide.html'
);
$install_guide
=
phutil_tag
(
'a'
,
array
(
'href'
=>
$href
,
'class'
=>
'bright-link'
,
),
'Installation Guide'
);
return
'<div class="dark-console-no-content">'
.
'The "xhprof" PHP extension is not available. Install xhprof '
.
'to enable the XHProf console plugin. You can find instructions in '
.
'the '
.
$install_guide
.
'.'
.
'</div>'
;
}
$result
=
array
();
$run
=
$this
->
getXHProfRunID
();
$header
=
'<div class="dark-console-panel-header">'
.
phutil_tag
(
'a'
,
array
(
'href'
=>
$this
->
getRequestURI
()->
alter
(
'__profile__'
,
'page'
),
'class'
=>
$run
?
'disabled button'
:
'green button'
,
),
'Profile Page'
).
'<h1>XHProf Profiler</h1>'
.
'</div>'
;
$result
[]
=
$header
;
if
(
$run
)
{
$result
[]
=
'<a href="/xhprof/profile/'
.
$run
.
'/" '
.
'class="bright-link" '
.
'style="float: right; margin: 1em 2em 0 0;'
.
'font-weight: bold;" '
.
'target="_blank">Profile Permalink</a>'
.
'<iframe src="/xhprof/profile/'
.
$run
.
'/?frame=true"></iframe>'
;
}
else
{
$result
[]
=
'<div class="dark-console-no-content">'
.
'Profiling was not enabled for this page. Use the button above '
.
'to enable it.'
.
'</div>'
;
}
return
implode
(
"
\n
"
,
$result
);
}
public
function
willShutdown
()
{
if
(
DarkConsoleXHProfPluginAPI
::
isProfilerRequested
()
&&
(
DarkConsoleXHProfPluginAPI
::
isProfilerRequested
()
!==
'all'
))
{
$this
->
xhprofID
=
DarkConsoleXHProfPluginAPI
::
stopProfiler
();
}
}
}
Event Timeline
Log In to Comment