/** * Returns the total time the queries took to execute. * * You can use the constants in the Profiler class to specify * what kind of queries you want to get, e.g. Profiler::INSERT. * * @param integer $mode * @return float|integer */ public function getQueryTime($mode = null) { $time = 0; foreach ($this->profiler->getQueryProfiles($mode) as $query) { $time += $query->getElapsedTime(); } return $time; }
/** * @return Profiler */ public function profilerFinish() { $aReturn = parent::profilerFinish(); $oProfile = end($this->profiles); $aInfo = $oProfile->toArray(); $aDebugInfo = array("type" => __FUNCTION__, "connection_dsn" => $this->aConnectionParameters['dsn'], "time" => $aInfo['elapsed'], "sql" => $aInfo['sql'], "datas" => is_object($aInfo['parameters']) ? $aInfo['parameters']->getNamedArray() : $aInfo['parameters']); \YcheukfDebug\Model\Debug::dump($aDebugInfo, "[inline]---[db]---" . __CLASS__); return $aReturn; }
public function profilerFinish() { parent::profilerFinish(); /** @var Query $lastQuery */ $lastQuery = end($this->profiles); $this->getLogger()->log($this->getPriority(), 'Query finished', array_intersect_key($lastQuery->toArray(), array_flip($this->getParametersFinish()))); $maxProfiles = $this->getMaxProfiles(); if ($maxProfiles > -1) { if (count($this->profiles) > $maxProfiles) { $this->profiles = array(); } } }
public function endQuery() { parent::endQuery(); $this->logEnd(); $this->trimToMaxQueries(); }