diff --git a/src/aphront/console/plugin/xhprof/DarkConsoleXHProfPlugin.php b/src/aphront/console/plugin/xhprof/DarkConsoleXHProfPlugin.php index aa5ebb0e9..bf8c337d7 100755 --- a/src/aphront/console/plugin/xhprof/DarkConsoleXHProfPlugin.php +++ b/src/aphront/console/plugin/xhprof/DarkConsoleXHProfPlugin.php @@ -1,112 +1,135 @@ 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()) { return '

The "xhprof" PHP extension is not available. Install xhprof '. 'to enable the XHProf plugin.'; } + + $run = $this->getXHProfRunID(); + if ($run) { + return 'View Run'; + } else { + $hidden = array(); + $data = array('__profile__' => 'page') + $_GET; + + foreach ($data as $k => $v) { + $hidden[] = phutil_render_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => $k, + 'value' => $v, + )); + } + $hidden = implode("\n", $hidden); + + + return + '

'. + $hidden. + ''. + '
'; + } + } + - return '...'; + 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

Permalink