コード例 #1
0
 public static function printProfilerData()
 {
     $profiler = RealEstateAgency_Database::getProfiler();
     if (!$profiler) {
         return;
     }
     $line = ". . . . . . . . . . . . . . . . . . . .";
     echo "{$line}\n";
     echo "Database profiler information:\n";
     $totalTime = $profiler->getTotalElapsedSecs();
     $queryCount = $profiler->getTotalNumQueries();
     $longestTime = 0;
     $longestQuery = null;
     foreach ($profiler->getQueryProfiles() as $query) {
         // echo "Query: [" . $query->getQuery() . "]\n";
         if ($query->getElapsedSecs() > $longestTime) {
             $longestTime = $query->getElapsedSecs();
             $longestQuery = $query->getQuery();
         }
     }
     // echo "$line\n";
     echo 'Executed ' . $queryCount . ' queries in ' . $totalTime . ' seconds' . "\n";
     // echo 'Average query length: ' . $totalTime / $queryCount . ' seconds' . "\n";
     // echo 'Queries per second: ' . $queryCount / $totalTime . "\n";
     echo 'Longest query length: ' . $longestTime . "\n";
     // echo "Longest query: " . $longestQuery . "\n";
     echo "{$line}\n";
 }
コード例 #2
0
 private function startConnection()
 {
     $this->db = RealEstateAgency_Database::createConnection();
 }
コード例 #3
0
 static function initializeProfiler()
 {
     self::$enable_profiler = true;
 }