]> git.localhorst.tv Git - alttp.git/blobdiff - app/Console/Commands/ChatlibGenerate.php
revamp chatlib tokenization
[alttp.git] / app / Console / Commands / ChatlibGenerate.php
index 5ea85f6838bcc19a326c9dbb8cc88eb626ed5ac3..caa223d51495323e446246c871a3139d0bc825c6 100644 (file)
@@ -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;