mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
Add query parsing timings
This commit is contained in:
@@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Stopwatch\Stopwatch;
|
||||||
|
|
||||||
class QueryParseCommand extends Command
|
class QueryParseCommand extends Command
|
||||||
{
|
{
|
||||||
@@ -64,6 +65,10 @@ class QueryParseCommand extends Command
|
|||||||
$postprocessing = !$input->getOption('no-compiler-postprocessing');
|
$postprocessing = !$input->getOption('no-compiler-postprocessing');
|
||||||
|
|
||||||
$parser = $this->container['query_parser'];
|
$parser = $this->container['query_parser'];
|
||||||
|
|
||||||
|
$stopwatch = new Stopwatch();
|
||||||
|
$stopwatch->start('parsing');
|
||||||
|
|
||||||
if ($input->getOption('compiler-dump')) {
|
if ($input->getOption('compiler-dump')) {
|
||||||
$dump = $parser->dump($string, $postprocessing);
|
$dump = $parser->dump($string, $postprocessing);
|
||||||
} else {
|
} else {
|
||||||
@@ -71,8 +76,12 @@ class QueryParseCommand extends Command
|
|||||||
$dump = $query->dump();
|
$dump = $query->dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event = $stopwatch->stop('parsing');
|
||||||
|
|
||||||
if (!$raw) {
|
if (!$raw) {
|
||||||
$output->writeln($dump);
|
$output->writeln($dump);
|
||||||
|
$output->writeln(str_repeat('-', 20));
|
||||||
|
$output->writeln(sprintf("Took %sms", $event->getDuration()));
|
||||||
} else {
|
} else {
|
||||||
$output->write($dump);
|
$output->write($dump);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user