Timer class
Framework\Debug\Timer
Class Timer.
Defined in libraries/debug/src/Timer.php
Properties #
- $marks
- -
- $testsCount
- -
$marks
protected array $marks = array (
)
$testsCount
protected int $testsCount = 1
Methods #
- __construct()
- Timer constructor.
- addMark()
- -
- diff()
- -
- getMark()
- -
- getMarks()
- -
- setMark()
- -
- test()
- -
__construct()
public function __construct()
Timer constructor.
addMark()
public function addMark(string $name): static
Parameters
- string $name
Returns
static
diff()
public function diff(string $from, string $to): array
Parameters
- string $from
- string $to
Returns
array
- Two keys: memory in MB and time in seconds
getMark()
public function getMark(string $name): array|false
Parameters
- string $name
Returns
array|false
getMarks()
public function getMarks(bool $format = false): array
Parameters
- bool $format
Returns
array
setMark()
public function setMark(string $name, int $memoryUsage, float $microtime): static
Parameters
- string $name
- int $memoryUsage
- float $microtime
Returns
static
test()
public function test(int $times, callable $function, bool $flush = false): array
Parameters
- int $times
- callable $function
- bool $flush
Returns
array
- Two keys - "memory" in MB and "time" in seconds