IcingaConfig: use Benchmark

This commit is contained in:
Thomas Gelf 2016-01-19 16:45:20 +01:00
parent d26a7b07da
commit 5138501dc1
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use Icinga\Module\Director\Util;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaZone;
use Icinga\Module\Director\Objects\IcingaEndpoint;
use Icinga\Application\Benchmark;
use Icinga\Web\Hook;
use Exception;
@ -386,12 +387,14 @@ throw $e;
protected function createFileFromDb($type)
{
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
Benchmark::measure(sprintf('Prefetching %s', $type));
$objects = $class::prefetchAll($this->connection);
return $this->createFileForObjects($type, $objects);
}
protected function createFileForObjects($type, $objects)
{
Benchmark::measure(sprintf('Generating %d %s', count($objects), $type));
if (empty($objects)) return $this;
$masterZone = $this->getMasterZoneName();
$globalZone = $this->getGlobalZoneName();