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.
*
* @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;
}
}

View file

@ -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;
}

View file

@ -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();
}

View file

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