Timer
in package
Class Timer.
Table of Contents
Properties
- $marks : array<string, array<string, mixed>>
- $testsCount : int
Methods
- __construct() : mixed
- Timer constructor.
- addMark() : static
- diff() : array<string, string>
- getMark() : array<string, string>|false
- getMarks() : array<string, array<string, mixed>>
- setMark() : static
- test() : array<string, string>
Properties
$marks
protected
array<string, array<string, mixed>>
$marks
= []
$testsCount
protected
int
$testsCount
= 1
Methods
__construct()
Timer constructor.
public
__construct() : mixed
addMark()
public
addMark(string $name) : static
Parameters
- $name : string
Return values
staticdiff()
public
diff(string $from, string $to) : array<string, string>
Parameters
- $from : string
- $to : string
Attributes
- #[ArrayShape]
- ['memory' => 'string', 'time' => 'string']
Return values
array<string, string> —Two keys: memory in MB and time in seconds
getMark()
public
getMark(string $name) : array<string, string>|false
Parameters
- $name : string
Return values
array<string, string>|falsegetMarks()
public
getMarks([bool $format = false ]) : array<string, array<string, mixed>>
Parameters
- $format : bool = false
Return values
array<string, array<string, mixed>>setMark()
public
setMark(string $name, int $memoryUsage, float $microtime) : static
Parameters
- $name : string
- $memoryUsage : int
- $microtime : float
Return values
statictest()
public
test(int $times, callable $function[, bool $flush = false ]) : array<string, string>
Parameters
- $times : int
- $function : callable
- $flush : bool = false
Attributes
- #[ArrayShape]
- ['memory' => 'string', 'time' => 'string']
Return values
array<string, string> —Two keys - "memory" in MB and "time" in seconds