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_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 = '
'. phutil_tag( 'a', array( 'href' => $this->getRequestURI()->alter('__profile__', 'page'), 'class' => $run ? 'disabled button' : 'green button', ), 'Profile Page'). '

XHProf Profiler

'. '
'; $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 (DarkConsoleXHProfPluginAPI::isProfilerRequested() && (DarkConsoleXHProfPluginAPI::isProfilerRequested() !== 'all')) { $this->xhprofID = DarkConsoleXHProfPluginAPI::stopProfiler(); } } }