Allow specified the starting time of a stopwatch.
This commit is contained in:
parent
d06c105865
commit
6f9ab9136e
2 changed files with 8 additions and 4 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.2504.31447
|
0.2504.31450
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Stopwatch.php
|
// Stopwatch.php
|
||||||
// Created: 2021-04-26
|
// Created: 2021-04-26
|
||||||
// Updated: 2025-02-27
|
// Updated: 2025-04-03
|
||||||
|
|
||||||
namespace Index\Performance;
|
namespace Index\Performance;
|
||||||
|
|
||||||
|
@ -9,11 +9,15 @@ 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 $start = -1;
|
|
||||||
private int $elapsed = 0;
|
private int $elapsed = 0;
|
||||||
private int $frequency;
|
private int $frequency;
|
||||||
|
|
||||||
public function __construct() {
|
/**
|
||||||
|
* @param int $start Starting value, must be the output of hrtime(true) if specified.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
private int $start = -1
|
||||||
|
) {
|
||||||
$this->frequency = PerformanceCounter::frequency();
|
$this->frequency = PerformanceCounter::frequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue