Differential D13770 Diff 33258 src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
<?php | <?php | ||||
final class PhabricatorXHProfSampleListController | final class PhabricatorXHProfSampleListController | ||||
extends PhabricatorXHProfController { | extends PhabricatorXHProfController { | ||||
private $view; | |||||
public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
return true; | return true; | ||||
} | } | ||||
public function willProcessRequest(array $data) { | public function handleRequest(AphrontRequest $request) { | ||||
$this->view = idx($data, 'view', 'all'); | $viewer = $request->getViewer(); | ||||
} | $view = $request->getURIData('view'); | ||||
public function processRequest() { | if (!$view) { | ||||
$request = $this->getRequest(); | $view = 'all'; | ||||
$user = $request->getUser(); | } | ||||
$pager = new PHUIPagerView(); | $pager = new PHUIPagerView(); | ||||
$pager->setOffset($request->getInt('page')); | $pager->setOffset($request->getInt('page')); | ||||
switch ($this->view) { | switch ($view) { | ||||
case 'sampled': | case 'sampled': | ||||
$clause = 'sampleRate > 0'; | $clause = 'sampleRate > 0'; | ||||
$show_type = false; | $show_type = false; | ||||
break; | break; | ||||
case 'my-runs': | case 'my-runs': | ||||
$clause = qsprintf( | $clause = qsprintf( | ||||
id(new PhabricatorXHProfSample())->establishConnection('r'), | id(new PhabricatorXHProfSample())->establishConnection('r'), | ||||
'sampleRate = 0 AND userPHID = %s', | 'sampleRate = 0 AND userPHID = %s', | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | foreach ($samples as $sample) { | ||||
if ($rate == 0) { | if ($rate == 0) { | ||||
$item->addIcon('flag-6', pht('Manual Run')); | $item->addIcon('flag-6', pht('Manual Run')); | ||||
} else { | } else { | ||||
$item->addIcon('flag-7', pht('Sampled (1/%d)', $rate)); | $item->addIcon('flag-7', pht('Sampled (1/%d)', $rate)); | ||||
} | } | ||||
$item->addIcon( | $item->addIcon( | ||||
'none', | 'none', | ||||
phabricator_datetime($sample->getDateCreated(), $user)); | phabricator_datetime($sample->getDateCreated(), $viewer)); | ||||
$list->addItem($item); | $list->addItem($item); | ||||
} | } | ||||
$list->setPager($pager); | $list->setPager($pager); | ||||
$list->setNoDataString(pht('There are no profiling samples.')); | $list->setNoDataString(pht('There are no profiling samples.')); | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
Show All 10 Lines |