Supported Versions: PHP 7 >= 7.3.0, PHP 8
Get the system's high resolution time
<?php hrtime(bool $as_number = false): array|int|float|false
<?php $lastRestart = $this->getTimestampOfLastQueueRestart();
[$startTime, $jobsProcessed] = [hrtime(true) / 1e9, 0];
while (true) {
<?php $this->memoryExceeded($options->memory) => static::EXIT_MEMORY_LIMIT,
$this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS,
$options->stopWhenEmpty && is_null($job) => static::EXIT_SUCCESS,
$options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => static::EXIT_SUCCESS,
$options->maxJobs && $jobsProcessed >= $options->maxJobs => static::EXIT_SUCCESS,
default => null
};
<?php return collect(range(1, $iterations))->map(function () use ($callback) {
gc_collect_cycles();
$start = hrtime(true);
$callback();
<?php $callback();
return (hrtime(true) - $start) / 1000000;
})->average();
})->when(
$benchmarkables instanceof Closure,
<?php {
gc_collect_cycles();
$start = hrtime(true);
$result = $callback();
<?php $result = $callback();
return [$result, (hrtime(true) - $start) / 1000000];
}
<?php public function updateTime()
{
return $this->time = $this->useHighResolution ? \hrtime(true) * 1e-9 : \microtime(true);
}
public function getTime()