예제 #1
0
파일: walleye.php 프로젝트: Jsnrkd/Walleye
 public function __destruct()
 {
     $this->logs = Console::getLogs();
     $this->queries = Console::getQueries();
     // log the time the application took to execute
     $start_time = $this->startTime;
     $end_time = $this->endTime = microtime();
     $start_time_array = explode(' ', $start_time);
     $end_time_array = explode(' ', $end_time);
     $time = ($end_time_array[1] + $end_time_array[0] - ($start_time_array[1] + $start_time_array[0])) * 1000;
     // make time readable
     $ret = $time;
     $formatter = 0;
     $formats = array('ms', 's', 'm');
     if ($time >= 1000 && $time < 60000) {
         $formatter = 1;
         $ret = $time / 1000;
     }
     if ($time >= 60000) {
         $formatter = 2;
         $ret = $time / 1000 / 60;
     }
     $this->executionTime = $ret = number_format($ret, 3, '.', '') . ' ' . $formats[$formatter];
     if ($this->appOptions['PRINT_APP_INFO_ON_LOAD'] == true && !$this->isProduction() && !$this->isTesting()) {
         echo '<pre>';
         print_r($this);
         echo '</pre>';
     }
 }
예제 #2
0
파일: walleye.php 프로젝트: Jmayhak/Walleye
 /**
  * Print out the walleye object
  */
 public function __destruct()
 {
     if ($this->appOptions['PRINT_APP_INFO_ON_LOAD'] == true && $this->isProduction() == false && $this->isTesting() == false) {
         $this->logs = Console::getLogs();
         $this->queries = Console::getQueries();
         // log the time the application took to execute
         $start_time = $this->startTime;
         $end_time = $this->endTime = microtime();
         $start_time_array = explode(' ', $start_time);
         $end_time_array = explode(' ', $end_time);
         $time = ($end_time_array[1] + $end_time_array[0] - ($start_time_array[1] + $start_time_array[0])) * 1000;
         // make time readable
         $ret = $time;
         $formatter = 0;
         $formats = array('ms', 's', 'm');
         if ($time >= 1000 && $time < 60000) {
             $formatter = 1;
             $ret = $time / 1000;
         }
         if ($time >= 60000) {
             $formatter = 2;
             $ret = $time / 1000 / 60;
         }
         $this->executionTime = $ret = number_format($ret, 3, '.', '') . ' ' . $formats[$formatter];
         function convert($size)
         {
             $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
             return @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
         }
         $this->peak_memory_usage = convert(memory_get_peak_usage(true));
         print_object($this);
     }
 }