예제 #1
0
 static function cleanup()
 {
     $overall = round((microtime(true) - self::$start_time) * 1000);
     if (self::$curl_handle) {
         curl_close(self::$curl_handle);
         self::$curl_handle = false;
     }
     if (error_reporting() !== 0 && !self::$rss) {
         arsort(self::$timers);
         $t = array();
         $total = 0;
         $total = array_sum(self::$timers);
         foreach (self::$timers as $url => $time) {
             $p = round($time / $total * 100);
             $time = round($time * 1000);
             $t[] = "{$time}ms ({$p}%)\n\t----------------------------------\n\t{$url}";
         }
         $total = round($total * 1000);
         return "<!--\n\n\tKOKEN DEBUGGING (Longest requests first)\n\n\t" . join("\n\n\t", $t) . "\n\n\tTotal API calls: " . count(self::$timers) . "\n\tTotal API time: {$total}ms\n\tTotal time: {$overall}ms\n-->";
     }
 }