1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

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
This commit is contained in:
epriestley 2012-05-21 12:47:29 -07:00
parent 0548dc4c4c
commit 3fd93b594e
3 changed files with 48 additions and 2 deletions

View file

@ -51,6 +51,7 @@ final class PhabricatorXHProfProfileController
$view->setSymbol($symbol);
} else {
$view = new PhabricatorXHProfProfileTopLevelView();
$view->setFile($file);
$view->setLimit(100);
}

View file

@ -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();

View file

@ -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');