From 3fd93b594eadce17b2f838fbd98aca08e6f388c1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 21 May 2012 12:47:29 -0700 Subject: [PATCH] Make XHProf easier for me to use with other users Summary: Ideally there should be a "send epriestley this profile" button but this is a reasonable step forward. Add a "download .xhprof profile" button to profiles, since walking through these things remotely is pretty awkward. Also expand "Excl" and "Incl" acronyms. Test Plan: Clicked download button. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2523 --- .../PhabricatorXHProfProfileController.php | 1 + .../PhabricatorXHProfProfileTopLevelView.php | 46 ++++++++++++++++++- .../xhprof/view/toplevel/__init__.php | 3 ++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/applications/xhprof/controller/profile/PhabricatorXHProfProfileController.php b/src/applications/xhprof/controller/profile/PhabricatorXHProfProfileController.php index 695aae2df1..6a361f7386 100644 --- a/src/applications/xhprof/controller/profile/PhabricatorXHProfProfileController.php +++ b/src/applications/xhprof/controller/profile/PhabricatorXHProfProfileController.php @@ -51,6 +51,7 @@ final class PhabricatorXHProfProfileController $view->setSymbol($symbol); } else { $view = new PhabricatorXHProfProfileTopLevelView(); + $view->setFile($file); $view->setLimit(100); } diff --git a/src/applications/xhprof/view/toplevel/PhabricatorXHProfProfileTopLevelView.php b/src/applications/xhprof/view/toplevel/PhabricatorXHProfProfileTopLevelView.php index cdeb8c6b29..a8155848fd 100644 --- a/src/applications/xhprof/view/toplevel/PhabricatorXHProfProfileTopLevelView.php +++ b/src/applications/xhprof/view/toplevel/PhabricatorXHProfProfileTopLevelView.php @@ -24,6 +24,7 @@ final class PhabricatorXHProfProfileTopLevelView private $profileData; private $limit; + private $file; public function setProfileData(array $data) { $this->profileData = $data; @@ -35,6 +36,11 @@ final class PhabricatorXHProfProfileTopLevelView return $this; } + public function setFile(PhabricatorFile $file) { + $this->file = $file; + return $this; + } + public function render() { DarkConsoleXHProfPluginAPI::includeXHProfLib(); @@ -87,14 +93,38 @@ final class PhabricatorXHProfProfileTopLevelView ); } + Javelin::initBehavior('phabricator-tooltips'); + $table = new AphrontTableView($rows); $table->setHeaders( array( 'Symbol', 'Count', - 'Incl Wall Time', + javelin_render_tag( + 'span', + array( + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => 'Total wall time spent in this function and all of '. + 'its children (chilren are other functions it called '. + 'while executing).', + 'size' => 200, + ), + ), + 'Wall Time (Inclusive)'), '%', - 'Excl Wall Time', + javelin_render_tag( + 'span', + array( + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => 'Wall time spent in this function, excluding time '. + 'spent in children (children are other functions it '. + 'called while executing).', + 'size' => 200, + ), + ), + 'Wall Time (Exclusive)'), '%', )); $table->setColumnClasses( @@ -109,6 +139,18 @@ final class PhabricatorXHProfProfileTopLevelView $panel = new AphrontPanelView(); $panel->setHeader('XHProf Profile'); + + if ($this->file) { + $panel->addButton( + phutil_render_tag( + 'a', + array( + 'href' => $this->file->getBestURI(), + 'class' => 'green button', + ), + 'Download .xhprof Profile')); + } + $panel->appendChild($table); return $panel->render(); diff --git a/src/applications/xhprof/view/toplevel/__init__.php b/src/applications/xhprof/view/toplevel/__init__.php index 1602770d0f..87a8f48a57 100644 --- a/src/applications/xhprof/view/toplevel/__init__.php +++ b/src/applications/xhprof/view/toplevel/__init__.php @@ -8,9 +8,12 @@ phutil_require_module('phabricator', 'aphront/console/plugin/xhprof/api'); phutil_require_module('phabricator', 'applications/xhprof/view/base'); +phutil_require_module('phabricator', 'infrastructure/javelin/api'); +phutil_require_module('phabricator', 'infrastructure/javelin/markup'); phutil_require_module('phabricator', 'view/control/table'); phutil_require_module('phabricator', 'view/layout/panel'); +phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'utils');