Removed 32-bit related type signatures.

This commit is contained in:
flash 2024-08-01 23:22:49 +00:00
parent ecabe53123
commit 3d0c81541d
5 changed files with 28 additions and 28 deletions

View file

@ -1 +1 @@
0.2408.12321 0.2408.12322

View file

@ -12,28 +12,28 @@ final class PerformanceCounter {
/** /**
* Timer frequency in ticks per second. * 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; return 1000000;
} }
/** /**
* Current ticks from the system. * 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); return hrtime(true);
} }
/** /**
* Ticks elapsed since the given value. * Ticks elapsed since the given value.
* *
* @param int|float $since Starting ticks value. * @param int $since Starting ticks value.
* @return int|float Ticks count since. * @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; return self::getTicks() - $since;
} }
} }

View file

@ -9,9 +9,9 @@ namespace Index\Performance;
* Provides a means to measure elapsed time at a high resolution. * Provides a means to measure elapsed time at a high resolution.
*/ */
class Stopwatch { class Stopwatch {
private int|float $start = -1; private int $start = -1;
private int|float $elapsed = 0; private int $elapsed = 0;
private int|float $frequency; private int $frequency;
public function __construct() { public function __construct() {
$this->frequency = PerformanceCounter::getFrequency(); $this->frequency = PerformanceCounter::getFrequency();
@ -47,9 +47,9 @@ class Stopwatch {
/** /**
* Gets the number of ticks that have elapsed. * 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; $elapsed = $this->elapsed;
if($this->start >= 0) if($this->start >= 0)
$elapsed += PerformanceCounter::getTicksSince($this->start); $elapsed += PerformanceCounter::getTicksSince($this->start);
@ -59,9 +59,9 @@ class Stopwatch {
/** /**
* Gets the number of elapsed milliseconds. * 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; return $this->getElapsedTicks() / $this->frequency;
} }

View file

@ -9,20 +9,20 @@ namespace Index\Performance;
* Represents a timing point. * Represents a timing point.
*/ */
class TimingPoint { class TimingPoint {
private int|float $timePoint; private int $timePoint;
private int|float $duration; private int $duration;
private string $name; private string $name;
private string $comment; private string $comment;
/** /**
* @param int|float $timePoint Starting tick count. * @param int $timePoint Starting tick count.
* @param int|float $duration Duration ticks count. * @param int $duration Duration ticks count.
* @param string $name Name of the timing point. * @param string $name Name of the timing point.
* @param string $comment Timing point comment. * @param string $comment Timing point comment.
*/ */
public function __construct( public function __construct(
int|float $timePoint, int $timePoint,
int|float $duration, int $duration,
string $name, string $name,
string $comment string $comment
) { ) {
@ -35,27 +35,27 @@ class TimingPoint {
/** /**
* Gets the starting ticks count. * 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; return $this->timePoint;
} }
/** /**
* Gets the duration ticks count. * 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; return $this->duration;
} }
/** /**
* Gets the duration time amount. * 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(); return $this->duration / PerformanceCounter::getFrequency();
} }

View file

@ -12,7 +12,7 @@ use InvalidArgumentException;
*/ */
class Timings { class Timings {
private Stopwatch $sw; private Stopwatch $sw;
private int|float $lastLapTicks; private int $lastLapTicks;
private array $laps; private array $laps;
/** /**