1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Modernize XHProf

Summary: Use modern components, pht

Test Plan: I have no data locally, expect @epriestley to commandeer

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11805
This commit is contained in:
Chad Little 2015-02-18 11:51:12 -08:00
parent 7f1914540f
commit 11f0c1a47d
4 changed files with 32 additions and 25 deletions

View file

@ -43,10 +43,13 @@ final class PhabricatorXHProfProfileController
$view->setIsFramed($is_framed); $view->setIsFramed($is_framed);
$view->setProfileData($data); $view->setProfileData($data);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('%s Profile', $symbol));
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$view, array($crumbs, $view),
array( array(
'title' => 'Profile', 'title' => pht('Profile'),
'frame' => $is_framed, 'frame' => $is_framed,
)); ));
} }

View file

@ -80,12 +80,15 @@ final class PhabricatorXHProfSampleListController
} }
$list->setPager($pager); $list->setPager($pager);
$list->setNoDataString(pht('There are no profiling samples.'));
return $this->buildStandardPageResponse( $crumbs = $this->buildApplicationCrumbs();
$list, $crumbs->addTextCrumb(pht('XHProf Samples'));
return $this->buildApplicationPage(
array($crumbs, $list),
array( array(
'title' => pht('XHProf Samples'), 'title' => pht('XHProf Samples'),
'device' => true,
)); ));
} }

View file

@ -48,7 +48,7 @@ final class PhabricatorXHProfProfileSymbolView
$rows = array(); $rows = array();
$rows[] = array( $rows[] = array(
'Metrics for this Call', pht('Metrics for this Call'),
'', '',
'', '',
'', '',
@ -62,7 +62,7 @@ final class PhabricatorXHProfProfileSymbolView
)); ));
$rows[] = array( $rows[] = array(
'Parent Calls', pht('Parent Calls'),
'', '',
'', '',
'', '',
@ -79,7 +79,7 @@ final class PhabricatorXHProfProfileSymbolView
$rows[] = array( $rows[] = array(
'Child Calls', pht('Child Calls'),
'', '',
'', '',
'', '',
@ -102,9 +102,9 @@ final class PhabricatorXHProfProfileSymbolView
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Symbol', pht('Symbol'),
'Count', pht('Count'),
'Wall Time', pht('Wall Time'),
'%', '%',
)); ));
$table->setColumnClasses( $table->setColumnClasses(
@ -115,8 +115,8 @@ final class PhabricatorXHProfProfileSymbolView
'n', 'n',
)); ));
$panel = new AphrontPanelView(); $panel = new PHUIObjectBoxView();
$panel->setHeader('XHProf Profile'); $panel->setHeader(pht('XHProf Profile'));
$panel->appendChild($table); $panel->appendChild($table);
return $panel->render(); return $panel->render();

View file

@ -54,7 +54,7 @@ final class PhabricatorXHProfProfileTopLevelView
$rows = array(); $rows = array();
$rows[] = array( $rows[] = array(
'Total', pht('Total'),
number_format($totals['ct']), number_format($totals['ct']),
number_format($totals['wt']).' us', number_format($totals['wt']).' us',
'100.0%', '100.0%',
@ -82,16 +82,16 @@ final class PhabricatorXHProfProfileTopLevelView
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Symbol', pht('Symbol'),
'Count', pht('Count'),
javelin_tag( javelin_tag(
'span', 'span',
array( array(
'sigil' => 'has-tooltip', 'sigil' => 'has-tooltip',
'meta' => array( 'meta' => array(
'tip' => 'Total wall time spent in this function and all of '. 'tip' => pht('Total wall time spent in this function and all of '.
'its children (children are other functions it called '. 'its children (children are other functions it called '.
'while executing).', 'while executing).'),
'size' => 200, 'size' => 200,
), ),
), ),
@ -102,9 +102,9 @@ final class PhabricatorXHProfProfileTopLevelView
array( array(
'sigil' => 'has-tooltip', 'sigil' => 'has-tooltip',
'meta' => array( 'meta' => array(
'tip' => 'Wall time spent in this function, excluding time '. 'tip' => pht('Wall time spent in this function, excluding time '.
'spent in children (children are other functions it '. 'spent in children (children are other functions it '.
'called while executing).', 'called while executing).'),
'size' => 200, 'size' => 200,
), ),
), ),
@ -121,18 +121,19 @@ final class PhabricatorXHProfProfileTopLevelView
'n', 'n',
)); ));
$panel = new AphrontPanelView(); $panel = new PHUIObjectBoxView();
$panel->setHeader('XHProf Profile'); $header = id(new PHUIHeaderView())
->setHeaderText(pht('XHProf Profile'));
if ($this->file) { if ($this->file) {
$panel->addButton( $button = phutil_tag(
phutil_tag(
'a', 'a',
array( array(
'href' => $this->file->getBestURI(), 'href' => $this->file->getBestURI(),
'class' => 'green button', 'class' => 'green button',
), ),
'Download .xhprof Profile')); pht('Download .xhprof Profile'));
$header->addActionLink($button);
} }
$panel->appendChild($table); $panel->appendChild($table);