Exemplo n.º 1
0
 public function tick($logDebugText = '', $unit = 'ms', $roundPrecision = 0, $isMySQLTime = FALSE, $color = LogTool::COLOR_BLUE)
 {
     $logInstance = LogTool::getInstance();
     if ($unit == 's') {
         $getTimeFunction = 'getTimeSeconds';
     } else {
         $getTimeFunction = 'getTimeMicroseconds';
     }
     // Write debug message
     $logInstance->logDebug((isset($this->countValue) ? '[Increment = ' . $this->countValue . ']' : '') . 'Timer: ' . round($this->{$getTimeFunction}(), $roundPrecision) . ' ' . $unit . ($this->lastTickTime ? ' (' . round($this->{$getTimeFunction}(TRUE), $roundPrecision) . ' ' . $unit . ' since last tick)' : '') . ' : ' . $logDebugText, $color);
     // Adds to cumulative timers
     if ($isMySQLTime) {
         $this->mysqlCumulativeTime += $this->getTimeMicroseconds(TRUE);
         LogTool::getInstance()->logTrace($color);
     } else {
         $this->phpCumulativeTime += $this->getTimeMicroseconds(TRUE);
     }
     // Remember current microTime
     $this->lastTickTime = TimerTool::getMicrotimeFloat();
 }