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')) {
|
if ($input->hasParameterOption('--profile')) {
|
||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
|
$this->io->enableDebugging($startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldWorkingDir = getcwd();
|
$oldWorkingDir = getcwd();
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ConsoleIO implements IOInterface
|
||||||
protected $helperSet;
|
protected $helperSet;
|
||||||
protected $authentications = array();
|
protected $authentications = array();
|
||||||
protected $lastMessage;
|
protected $lastMessage;
|
||||||
|
private $startTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -44,6 +45,11 @@ class ConsoleIO implements IOInterface
|
||||||
$this->helperSet = $helperSet;
|
$this->helperSet = $helperSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enableDebugging($startTime)
|
||||||
|
{
|
||||||
|
$this->startTime = $startTime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -73,6 +79,15 @@ class ConsoleIO implements IOInterface
|
||||||
*/
|
*/
|
||||||
public function write($messages, $newline = true)
|
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->output->write($messages, $newline);
|
||||||
$this->lastMessage = join($newline ? "\n" : '', (array) $messages);
|
$this->lastMessage = join($newline ? "\n" : '', (array) $messages);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue