Add more output to the profiled runs, refs #1659
parent
b10bd5f161
commit
b474944155
|
@ -102,6 +102,7 @@ class Application extends BaseApplication
|
|||
|
||||
if ($input->hasParameterOption('--profile')) {
|
||||
$startTime = microtime(true);
|
||||
$this->io->enableDebugging($startTime);
|
||||
}
|
||||
|
||||
$oldWorkingDir = getcwd();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue