50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
|
<?php
|
||
|
// TimingPoint.php
|
||
|
// Created: 2022-02-16
|
||
|
// Updated: 2022-02-28
|
||
|
|
||
|
namespace Index\Performance;
|
||
|
|
||
|
class TimingPoint {
|
||
|
private int|float $timePoint;
|
||
|
private int|float $duration;
|
||
|
private string $name;
|
||
|
private string $comment;
|
||
|
|
||
|
public function __construct(
|
||
|
int|float $timePoint,
|
||
|
int|float $duration,
|
||
|
string $name,
|
||
|
string $comment
|
||
|
) {
|
||
|
$this->timePoint = $timePoint;
|
||
|
$this->duration = $duration;
|
||
|
$this->name = $name;
|
||
|
$this->comment = $comment;
|
||
|
}
|
||
|
|
||
|
public function getTimePointTicks(): int|float {
|
||
|
return $this->timePoint;
|
||
|
}
|
||
|
|
||
|
public function getDurationTicks(): int|float {
|
||
|
return $this->duration;
|
||
|
}
|
||
|
|
||
|
public function getDurationTime(): float {
|
||
|
return $this->duration / PerformanceCounter::getFrequency();
|
||
|
}
|
||
|
|
||
|
public function getName(): string {
|
||
|
return $this->name;
|
||
|
}
|
||
|
|
||
|
public function hasComment(): bool {
|
||
|
return $this->comment !== '';
|
||
|
}
|
||
|
|
||
|
public function getComment(): string {
|
||
|
return $this->comment;
|
||
|
}
|
||
|
}
|