Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Queries duration in Propel1 Bridge DataCollector

  • Loading branch information...
commit 26496d00cb73e886afdac3e03fb428c275148f90 1 parent c4ded6a
@jeremyFreeAgent jeremyFreeAgent authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/Symfony/Bridge/Propel1/DataCollector/PropelDataCollector.php
View
24 src/Symfony/Bridge/Propel1/DataCollector/PropelDataCollector.php
@@ -56,6 +56,8 @@ public function collect(Request $request, Response $response, \Exception $except
'queries' => $this->buildQueries(),
'querycount' => $this->countQueries(),
);
+
+ $this->data['queriesduration'] = $this->countQueriesDuration();
}
/**
@@ -88,6 +90,11 @@ public function getQueryCount()
return $this->data['querycount'];
}
+ public function getQueriesDuration()
+ {
+ return $this->data['queriesduration'];
+ }
+
/**
* Creates an array of Build objects.
*
@@ -125,4 +132,21 @@ private function countQueries()
{
return count($this->logger->getQueries());
}
+
+ /**
+ * Count the queries duration.
+ *
+ * @return int The number of queries.
+ */
+ private function countQueriesDuration()
+ {
+ $duration = 0;
+ foreach ($this->data['queries'] as $queries) {
+ foreach ($queries as $query) {
+ $duration += $query['time'];
+ }
+ }
+
+ return $duration;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.