X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FChatlibGenerate.php;h=caa223d51495323e446246c871a3139d0bc825c6;hb=1dea58cb6fa9cf28966e75c1e1af87f67e6c0fd1;hp=5ea85f6838bcc19a326c9dbb8cc88eb626ed5ac3;hpb=a45648fa8ecf7712c7fd00eb2b93e862b5264f04;p=alttp.git diff --git a/app/Console/Commands/ChatlibGenerate.php b/app/Console/Commands/ChatlibGenerate.php index 5ea85f6..caa223d 100644 --- a/app/Console/Commands/ChatlibGenerate.php +++ b/app/Console/Commands/ChatlibGenerate.php @@ -12,7 +12,7 @@ class ChatlibGenerate extends Command { * * @var string */ - protected $signature = 'chatlib:generate {which=de} {amount=50}'; + protected $signature = 'chatlib:generate {which=de} {amount=50} {context?}'; /** * The console command description. @@ -27,12 +27,19 @@ class ChatlibGenerate extends Command { * @return int */ public function handle() { + + $start = microtime(true); + $this->line('loading database'); $db = new ChatLib(); $db->loadFrom($this->argument('which')); + $this->line( + number_format(microtime(true) - $start, 2).'s '. + number_format(memory_get_usage() / 1024 / 1024, 3).'MB now '. + number_format(memory_get_peak_usage() / 1024 / 1024, 3).'MB peak'); $amount = intval($this->argument('amount')); for ($i = 0; $i < $amount; ++$i) { - $this->line($db->generate()); + $this->line($db->generate($this->argument('context'))); } return 0;