forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Ref T8588. It looks like something slow is happening //before// we start DarkConsole. Add some crude reporting to try to narrow it down. Test Plan: {F743050} Reviewers: chad Reviewed By: chad Maniphest Tasks: T8588 Differential Revision: https://secure.phabricator.com/D13956
- Loading branch information
epriestley
committed
Aug 21, 2015
1 parent
d825aae
commit 4b1815d
Showing
7 changed files
with
219 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/applications/console/plugin/DarkConsoleStartupPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
final class DarkConsoleStartupPlugin extends DarkConsolePlugin { | ||
|
||
public function getName() { | ||
return pht('Startup'); | ||
} | ||
|
||
public function getDescription() { | ||
return pht('Timing information about the startup sequence.'); | ||
} | ||
|
||
/** | ||
* @phutil-external-symbol class PhabricatorStartup | ||
*/ | ||
public function generateData() { | ||
return PhabricatorStartup::getPhases(); | ||
} | ||
|
||
public function renderPanel() { | ||
$data = $this->getData(); | ||
|
||
// Compute the time offset and duration of each startup phase. | ||
$prev_key = null; | ||
$init = null; | ||
$phases = array(); | ||
foreach ($data as $key => $value) { | ||
if ($init === null) { | ||
$init = $value; | ||
} | ||
|
||
$offset = (int)floor(1000 * ($value - $init)); | ||
|
||
$phases[$key] = array( | ||
'time' => $value, | ||
'offset' => $value - $init, | ||
); | ||
|
||
|
||
if ($prev_key !== null) { | ||
$phases[$prev_key]['duration'] = $value - $phases[$prev_key]['time']; | ||
} | ||
$prev_key = $key; | ||
} | ||
|
||
// Render the phases. | ||
$rows = array(); | ||
foreach ($phases as $key => $phase) { | ||
$offset_ms = (int)floor(1000 * $phase['offset']); | ||
|
||
if (isset($phase['duration'])) { | ||
$duration_us = (int)floor(1000000 * $phase['duration']); | ||
} else { | ||
$duration_us = null; | ||
} | ||
|
||
$rows[] = array( | ||
$key, | ||
pht('+%s ms', new PhutilNumber($offset_ms)), | ||
($duration_us === null) | ||
? pht('-') | ||
: pht('%s us', new PhutilNumber($duration_us)), | ||
null, | ||
); | ||
} | ||
|
||
return id(new AphrontTableView($rows)) | ||
->setHeaders( | ||
array( | ||
pht('Phase'), | ||
pht('Offset'), | ||
pht('Duration'), | ||
null, | ||
)) | ||
->setColumnClasses( | ||
array( | ||
'', | ||
'n right', | ||
'n right', | ||
'wide', | ||
)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters