function ResourceUsageFormatter::resourceUsageSinceStartOfRequest
Throws
TimeSinceStartOfRequestNotAvailableException
File
-
vendor/
phpunit/ php-timer/ src/ ResourceUsageFormatter.php, line 40
Class
Namespace
SebastianBergmann\TimerCode
public function resourceUsageSinceStartOfRequest() : string {
if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) {
throw new TimeSinceStartOfRequestNotAvailableException('Cannot determine time at which the request started because $_SERVER[\'REQUEST_TIME_FLOAT\'] is not available');
}
if (!is_float($_SERVER['REQUEST_TIME_FLOAT'])) {
throw new TimeSinceStartOfRequestNotAvailableException('Cannot determine time at which the request started because $_SERVER[\'REQUEST_TIME_FLOAT\'] is not of type float');
}
return $this->resourceUsage(Duration::fromMicroseconds(1000000 * (microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'])));
}