Changeset View
Changeset View
Standalone View
Standalone View
src/applications/xhprof/storage/PhabricatorXHProfSample.php
<?php | <?php | ||||
final class PhabricatorXHProfSample | final class PhabricatorXHProfSample | ||||
extends PhabricatorXHProfDAO | extends PhabricatorXHProfDAO | ||||
implements PhabricatorPolicyInterface { | implements PhabricatorPolicyInterface { | ||||
protected $filePHID; | protected $filePHID; | ||||
protected $usTotal; | protected $usTotal; | ||||
protected $sampleRate; | protected $sampleRate; | ||||
protected $hostname; | protected $hostname; | ||||
protected $requestPath; | protected $requestPath; | ||||
protected $controller; | protected $controller; | ||||
protected $userPHID; | protected $userPHID; | ||||
public static function initializeNewSample() { | |||||
return id(new self()) | |||||
->setUsTotal(0) | |||||
->setSampleRate(0); | |||||
} | |||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'sampleRate' => 'uint32', | 'sampleRate' => 'uint32', | ||||
'usTotal' => 'uint64', | 'usTotal' => 'uint64', | ||||
'hostname' => 'text255?', | 'hostname' => 'text255?', | ||||
'requestPath' => 'text255?', | 'requestPath' => 'text255?', | ||||
'controller' => 'text255?', | 'controller' => 'text255?', | ||||
'userPHID' => 'phid?', | 'userPHID' => 'phid?', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'filePHID' => array( | 'filePHID' => array( | ||||
'columns' => array('filePHID'), | 'columns' => array('filePHID'), | ||||
'unique' => true, | 'unique' => true, | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function getURI() { | |||||
return '/xhprof/profile/'.$this->getFilePHID().'/'; | |||||
} | |||||
public function getDisplayName() { | |||||
$request_path = $this->getRequestPath(); | |||||
if (strlen($request_path)) { | |||||
return $request_path; | |||||
} | |||||
return pht('Unnamed Sample'); | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
); | ); | ||||
Show All 14 Lines |