diff --git a/src/aphront/console/plugin/services/DarkConsoleServicesPlugin.php b/src/aphront/console/plugin/services/DarkConsoleServicesPlugin.php index 91da2d5f01..dc053dfa6e 100644 --- a/src/aphront/console/plugin/services/DarkConsoleServicesPlugin.php +++ b/src/aphront/console/plugin/services/DarkConsoleServicesPlugin.php @@ -29,14 +29,19 @@ class DarkConsoleServicesPlugin extends DarkConsolePlugin { } public function generateData() { - return PhutilServiceProfiler::getInstance()->getServiceCallLog(); + + return array( + 'start' => $GLOBALS['__start__'], + 'log' => PhutilServiceProfiler::getInstance()->getServiceCallLog(), + ); } public function render() { $data = $this->getData(); + $log = $data['log']; $rows = array(); - foreach ($data as $row) { + foreach ($log as $row) { switch ($row['type']) { case 'query': @@ -62,6 +67,7 @@ class DarkConsoleServicesPlugin extends DarkConsolePlugin { $rows[] = array( phutil_escape_html($row['type']), + '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms', number_format(1000000 * $row['duration']).' us', $info, ); @@ -72,11 +78,13 @@ class DarkConsoleServicesPlugin extends DarkConsolePlugin { array( null, 'n', + 'n', 'wide wrap', )); $table->setHeaders( array( 'Event', + 'Start', 'Duration', 'Details', )); diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php index f3a1c3fc58..76a89b775a 100644 --- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php @@ -435,8 +435,26 @@ class DifferentialChangesetParser { $this->oldRender = explode("\n", phutil_escape_html($old_corpus_block)); $this->newRender = explode("\n", phutil_escape_html($new_corpus_block)); } else { - $this->oldRender = $this->sourceHighlight($this->old, $old_corpus_block); - $this->newRender = $this->sourceHighlight($this->new, $new_corpus_block); + $old_future = $this->getHighlightFuture($old_corpus_block); + $new_future = $this->getHighlightFuture($new_corpus_block); + $futures = array( + 'old' => $old_future, + 'new' => $new_future, + ); + foreach (Futures($futures) as $key => $future) { + switch ($key) { + case 'old': + $this->oldRender = $this->processHighlightedSource( + $this->old, + $future->resolve()); + break; + case 'new': + $this->newRender = $this->processHighlightedSource( + $this->new, + $future->resolve()); + break; + } + } } $this->applyIntraline( @@ -648,10 +666,13 @@ class DifferentialChangesetParser { } } - protected function sourceHighlight($data, $corpus) { - $result = $this->highlightEngine->highlightSource( + protected function getHighlightFuture($corpus) { + return $this->highlightEngine->getHighlightFuture( $this->filetype, $corpus); + } + + protected function processHighlightedSource($data, $result) { $result_lines = explode("\n", $result); foreach ($data as $key => $info) { diff --git a/src/applications/differential/parser/changeset/__init__.php b/src/applications/differential/parser/changeset/__init__.php index 2dc0087010..e6fd9e2ec8 100644 --- a/src/applications/differential/parser/changeset/__init__.php +++ b/src/applications/differential/parser/changeset/__init__.php @@ -20,6 +20,7 @@ phutil_require_module('phabricator', 'storage/queryfx'); phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'filesystem/tempfile'); +phutil_require_module('phutil', 'future'); phutil_require_module('phutil', 'future/exec'); phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'markup/syntax/engine/default'); diff --git a/webroot/index.php b/webroot/index.php index 4223c289f8..c02cb46404 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -16,6 +16,7 @@ * limitations under the License. */ +$__start__ = microtime(true); error_reporting(E_ALL | E_STRICT); ini_set('memory_limit', -1);