diff --git a/VERSION b/VERSION index 0991064..2d66d3d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2408.12321 +0.2408.12322 diff --git a/src/Performance/PerformanceCounter.php b/src/Performance/PerformanceCounter.php index 631b149..3cb24a7 100644 --- a/src/Performance/PerformanceCounter.php +++ b/src/Performance/PerformanceCounter.php @@ -12,28 +12,28 @@ final class PerformanceCounter { /** * Timer frequency in ticks per second. * - * @return int|float Timer frequency. + * @return int Timer frequency. */ - public static function getFrequency(): int|float { + public static function getFrequency(): int { return 1000000; } /** * Current ticks from the system. * - * @return int|float Ticks count. + * @return int Ticks count. */ - public static function getTicks(): int|float { + public static function getTicks(): int { return hrtime(true); } /** * Ticks elapsed since the given value. * - * @param int|float $since Starting ticks value. - * @return int|float Ticks count since. + * @param int $since Starting ticks value. + * @return int Ticks count since. */ - public static function getTicksSince(int|float $since): int|float { + public static function getTicksSince(int $since): int { return self::getTicks() - $since; } } diff --git a/src/Performance/Stopwatch.php b/src/Performance/Stopwatch.php index 951a4ef..e6fbc1c 100644 --- a/src/Performance/Stopwatch.php +++ b/src/Performance/Stopwatch.php @@ -9,9 +9,9 @@ namespace Index\Performance; * Provides a means to measure elapsed time at a high resolution. */ class Stopwatch { - private int|float $start = -1; - private int|float $elapsed = 0; - private int|float $frequency; + private int $start = -1; + private int $elapsed = 0; + private int $frequency; public function __construct() { $this->frequency = PerformanceCounter::getFrequency(); @@ -47,9 +47,9 @@ class Stopwatch { /** * Gets the number of ticks that have elapsed. * - * @return int|float Number of ticks. + * @return int Number of ticks. */ - public function getElapsedTicks(): int|float { + public function getElapsedTicks(): int { $elapsed = $this->elapsed; if($this->start >= 0) $elapsed += PerformanceCounter::getTicksSince($this->start); @@ -59,9 +59,9 @@ class Stopwatch { /** * Gets the number of elapsed milliseconds. * - * @return float Number of elapsed milliseconds. + * @return int Number of elapsed milliseconds. */ - public function getElapsedTime(): float { + public function getElapsedTime(): int { return $this->getElapsedTicks() / $this->frequency; } diff --git a/src/Performance/TimingPoint.php b/src/Performance/TimingPoint.php index 7aa25ba..f6acdeb 100644 --- a/src/Performance/TimingPoint.php +++ b/src/Performance/TimingPoint.php @@ -9,20 +9,20 @@ namespace Index\Performance; * Represents a timing point. */ class TimingPoint { - private int|float $timePoint; - private int|float $duration; + private int $timePoint; + private int $duration; private string $name; private string $comment; /** - * @param int|float $timePoint Starting tick count. - * @param int|float $duration Duration ticks count. + * @param int $timePoint Starting tick count. + * @param int $duration Duration ticks count. * @param string $name Name of the timing point. * @param string $comment Timing point comment. */ public function __construct( - int|float $timePoint, - int|float $duration, + int $timePoint, + int $duration, string $name, string $comment ) { @@ -35,27 +35,27 @@ class TimingPoint { /** * Gets the starting ticks count. * - * @return int|float Starting ticks count. + * @return int Starting ticks count. */ - public function getTimePointTicks(): int|float { + public function getTimePointTicks(): int { return $this->timePoint; } /** * Gets the duration ticks count. * - * @return int|float Duration ticks count. + * @return int Duration ticks count. */ - public function getDurationTicks(): int|float { + public function getDurationTicks(): int { return $this->duration; } /** * Gets the duration time amount. * - * @return float Duration time amount. + * @return int Duration time amount. */ - public function getDurationTime(): float { + public function getDurationTime(): int { return $this->duration / PerformanceCounter::getFrequency(); } diff --git a/src/Performance/Timings.php b/src/Performance/Timings.php index f8798f3..5382f1f 100644 --- a/src/Performance/Timings.php +++ b/src/Performance/Timings.php @@ -12,7 +12,7 @@ use InvalidArgumentException; */ class Timings { private Stopwatch $sw; - private int|float $lastLapTicks; + private int $lastLapTicks; private array $laps; /**