JBZoo\Utils\Timer::timeSinceStart PHP Method

timeSinceStart() public static method

Formats the elapsed time since the start of the request as a string.
public static timeSinceStart ( ) : float
return float
    public static function timeSinceStart()
    {
        return microtime(true) - self::getRequestTime();
    }

Usage Example

示例#1
0
 /**
  * Returns the resources (time, memory) of the request as a string.
  *
  * @param bool $getPeakMemory
  * @param bool $isRealMemory
  * @return string
  */
 public static function resourceUsage($getPeakMemory = true, $isRealMemory = false)
 {
     if ($getPeakMemory) {
         $message = 'Time: %s, Peak memory: %s';
         $memory = memory_get_peak_usage($isRealMemory);
     } else {
         $message = 'Time: %s, Memory: %s';
         $memory = memory_get_usage($isRealMemory);
     }
     $memory = FS::format($memory, 2);
     $time = Timer::format(Timer::timeSinceStart());
     return sprintf($message, $time, $memory);
 }
All Usage Examples Of JBZoo\Utils\Timer::timeSinceStart