1
0
Fork 0

Add more output to the profiled runs, refs #1659

pull/1661/merge
Jordi Boggiano 2013-03-05 15:21:54 +01:00
parent b10bd5f161
commit b474944155
2 changed files with 16 additions and 0 deletions

View File

@ -102,6 +102,7 @@ class Application extends BaseApplication
if ($input->hasParameterOption('--profile')) {
$startTime = microtime(true);
$this->io->enableDebugging($startTime);
}
$oldWorkingDir = getcwd();

View File

@ -29,6 +29,7 @@ class ConsoleIO implements IOInterface
protected $helperSet;
protected $authentications = array();
protected $lastMessage;
private $startTime;
/**
* Constructor.
@ -44,6 +45,11 @@ class ConsoleIO implements IOInterface
$this->helperSet = $helperSet;
}
public function enableDebugging($startTime)
{
$this->startTime = $startTime;
}
/**
* {@inheritDoc}
*/
@ -73,6 +79,15 @@ class ConsoleIO implements IOInterface
*/
public function write($messages, $newline = true)
{
if (null !== $this->startTime) {
$messages = (array) $messages;
$messages[0] = sprintf(
'[%.1fMB/%.2fs] %s',
memory_get_usage() / 1024 / 1024,
microtime(true) - $this->startTime,
$messages[0]
);
}
$this->output->write($messages, $newline);
$this->lastMessage = join($newline ? "\n" : '', (array) $messages);
}