RepositoryQuery: Benchmark when iterating a query's result

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-18 16:02:55 +02:00
parent 0e0341f78a
commit 9af25acf38
1 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace Icinga\Repository;
use Iterator;
use IteratorAggregate;
use Icinga\Application\Benchmark;
use Icinga\Application\Logger;
use Icinga\Data\QueryInterface;
use Icinga\Data\Filter\Filter;
@ -532,6 +533,7 @@ class RepositoryQuery implements QueryInterface, Iterator
}
$this->iterator->rewind();
Benchmark::measure('Query result iteration started');
}
/**
@ -562,7 +564,12 @@ class RepositoryQuery implements QueryInterface, Iterator
*/
public function valid()
{
return $this->iterator->valid();
if (! $this->iterator->valid()) {
Benchmark::measure('Query result iteration finished');
return false;
}
return true;
}
/**