Added some benchmark noise to DB queries

We need this to track down current performance issues, refs #5534
This commit is contained in:
Thomas Gelf 2014-01-22 12:36:44 +00:00
parent ad7e4451eb
commit 32c897c0c9

View File

@ -33,6 +33,7 @@ use Icinga\Filter\Query\Node;
use Icinga\Filter\Query\Tree; use Icinga\Filter\Query\Tree;
use Zend_Db_Select; use Zend_Db_Select;
use Icinga\Data\BaseQuery; use Icinga\Data\BaseQuery;
use Icinga\Application\Benchmark;
/** /**
* Db/Query class for implementing database queries * Db/Query class for implementing database queries
@ -230,7 +231,9 @@ class Query extends BaseQuery
public function count() public function count()
{ {
if ($this->countCache === null) { if ($this->countCache === null) {
Benchmark::measure('DB is counting');
$this->countCache = $this->db->fetchOne($this->getCountQuery()); $this->countCache = $this->db->fetchOne($this->getCountQuery());
Benchmark::measure('DB finished count');
} }
return $this->countCache; return $this->countCache;
} }
@ -242,7 +245,10 @@ class Query extends BaseQuery
*/ */
public function fetchAll() public function fetchAll()
{ {
return $this->db->fetchAll($this->getSelectQuery()); Benchmark::measure('DB is fetching All');
$result = $this->db->fetchAll($this->getSelectQuery());
Benchmark::measure('DB fetch done');
return $result;
} }
/** /**