50 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
52 $vn = ($output->getVerbosity() > Console\Output\OutputInterface::VERBOSITY_QUIET);
53 $vv = ($output->getVerbosity() >= Console\Output\OutputInterface::VERBOSITY_VERY_VERBOSE);
55 $path = $input->getOption(
'path');
59 $startTime = \microtime(
true);
60 $memoryBefore = \memory_get_usage();
61 $output->writeln(
'--------Translate::index-----------');
62 $output->writeln(
"Indexing path: {$path}");
74 $pathLang::$verbose = $vv;
75 $output->write(
"PathLangCollection::purge..");
78 $pathLang->purge($filt);
82 $time = round(\microtime(
true) - $startTime, 2);
83 $output->writeln(
"\tdone\t{$time}sec");
84 $output->write(
"PathLangCollection::collect..");
87 $pathLang->collect($filt);
91 $time = \round(\microtime(
true) - $startTime, 2);
92 $output->writeln(
"\tdone\t{$time}sec");
100 $pathIndex::$verbose = $vv;
101 $output->write(
"PathIndexCollection::purge..");
104 $pathIndex->purge($filt)->unvalidate($filt);
107 $time = \round(\microtime(
true) - $startTime, 2);
108 $output->writeln(
"\tdone\t{$time}sec");
109 $output->write(
"PathIndexCollection::collect..");
112 $pathIndex->collect($filt);
116 $time = \round(\microtime(
true) - $startTime, 2);
117 $output->writeln(
"\tdone\t{$time}sec");
125 $fileIndex::$verbose = $vv;
126 $output->write(
"FileIndexCollection::collect..");
129 $fileIndex->collect($filt);
133 $time = \round(\microtime(
true) - $startTime, 2);
134 $output->writeln(
"\tdone\t{$time}sec");
142 $phraseIndex::$verbose = $vv;
143 $output->write(
"PhraseIndexCollection::collect..");
146 $phraseIndex->collect($filt);
147 $pathIndex->validate($filt,
false);
152 $time = \round(\microtime(
true) - $startTime, 2);
153 $output->writeln(
"\tdone\t{$time}sec");
155 $memoryAfter = \memory_get_usage();
156 $memoryDiff = $memoryAfter - $memoryBefore;
157 $output->writeln(
'Memory usage: '.(\round($memoryAfter/1024/1024, 1)).
'M (+'.(\round($memoryDiff/1024/1024, 1)).
'M)');
158 $output->writeln(
'Memory peak usage: '.(\round(\memory_get_peak_usage()/1024/1024, 1)).
'M');