Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F462966
PhabricatorXHProfSampleSearchEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorXHProfSampleSearchEngine.php
View Options
<?php
final
class
PhabricatorXHProfSampleSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'XHProf Samples'
);
}
public
function
getApplicationClassName
()
{
return
PhabricatorXHProfApplication
::
class
;
}
public
function
newQuery
()
{
return
id
(
new
PhabricatorXHProfSampleQuery
());
}
protected
function
buildQueryFromParameters
(
array
$map
)
{
$query
=
$this
->
newQuery
();
return
$query
;
}
protected
function
buildCustomSearchFields
()
{
return
array
();
}
protected
function
getURI
(
$path
)
{
return
'/xhprof/'
.
$path
;
}
protected
function
getBuiltinQueryNames
()
{
$names
=
array
(
'all'
=>
pht
(
'All Samples'
),
);
return
$names
;
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
protected
function
renderResultList
(
array
$samples
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$samples
,
'PhabricatorXHProfSample'
);
$viewer
=
$this
->
requireViewer
();
$list
=
new
PHUIObjectItemListView
();
foreach
(
$samples
as
$sample
)
{
$file_phid
=
$sample
->
getFilePHID
();
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
$sample
->
getID
())
->
setHeader
(
$sample
->
getDisplayName
())
->
setHref
(
$sample
->
getURI
());
$us_total
=
$sample
->
getUsTotal
();
if
(
$us_total
)
{
$item
->
addAttribute
(
pht
(
"%s
\x
CE
\x
BCs"
,
new
PhutilNumber
(
$us_total
)));
}
if
(
$sample
->
getController
())
{
$item
->
addAttribute
(
$sample
->
getController
());
}
$item
->
addAttribute
(
$sample
->
getHostName
());
$rate
=
$sample
->
getSampleRate
();
if
(
$rate
==
0
)
{
$item
->
addIcon
(
'flag-6'
,
pht
(
'Manual Run'
));
}
else
{
$item
->
addIcon
(
'flag-7'
,
pht
(
'Sampled (1/%d)'
,
$rate
));
}
$item
->
addIcon
(
'none'
,
phabricator_datetime
(
$sample
->
getDateCreated
(),
$viewer
));
$list
->
addItem
(
$item
);
}
return
$this
->
newResultView
()
->
setObjectList
(
$list
);
}
private
function
newResultView
(
$content
=
null
)
{
// If we aren't rendering a dashboard panel, activate global drag-and-drop
// so you can import profiles by dropping them into the list.
if
(!
$this
->
isPanelContext
())
{
$drop_upload
=
id
(
new
PhabricatorGlobalUploadTargetView
())
->
setViewer
(
$this
->
requireViewer
())
->
setHintText
(
"
\x
E2
\x
87
\x
AA "
.
pht
(
'Drop .xhprof Files to Import'
))
->
setSubmitURI
(
'/xhprof/import/drop/'
)
->
setViewPolicy
(
PhabricatorPolicies
::
POLICY_NOONE
);
$content
=
array
(
$drop_upload
,
$content
,
);
}
return
id
(
new
PhabricatorApplicationSearchResultView
())
->
setContent
(
$content
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 6:41 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
73342
Default Alt Text
PhabricatorXHProfSampleSearchEngine.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment