getData();
if ($run) {
return '• 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_render_tag(
'a',
array(
'href' => $href,
'class' => 'bright-link',
),
'Installation Guide');
return
'
'.
'The "xhprof" PHP extension is not available. Install xhprof '.
'to enable the XHProf console plugin. You can find instructions in '.
'the '.$install_guide.'.'.
'
';
}
$result = array();
$run = $this->getXHProfRunID();
$header =
'';
$result[] = $header;
if ($run) {
$result[] =
'Profile Permalink'.
'';
} else {
$result[] =
''.
'Profiling was not enabled for this page. Use the button above '.
'to enable it.'.
'
';
}
return implode("\n", $result);
}
public function willShutdown() {
if (isset($_REQUEST['__profile__']) &&
$_REQUEST['__profile__'] != 'all') {
$this->xhprofID = DarkConsoleXHProfPluginAPI::stopProfiler();
}
}
}
/*
public function render() {
$run = $this->getData();
if ($run) {
$uri = 'http://www.intern.facebook.com/intern/phprof/?run='.$run;
return
XHProf Results
;
}
$uri = URI::getRequestURI();
return
XHProf
;
}
public function didShutdown() {
if ($this->xhprofData) {
require_module_lazy('profiling/phprof');
$this->xhprofID = phprof_save_run($this->xhprofData);
}
}
}
*/