1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
stopwatch.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Diag;
4
5
class
StopWatch
6
{
7
// seconds with nanoseconds
8
protected
?
float
$start
=
null
;
9
protected
float
$timer
= 0.0;
10
protected
int
$precision
;
11
12
public
function
__construct
(
int
$precision
= 6)
13
{
14
$this->precision =
$precision
;
15
}
16
17
public
function
start
(): static
18
{
19
$this->
start
= hrtime(
true
);
20
21
return
$this;
22
}
23
24
public
function
stop
(): float
25
{
26
if
($this->
start
!==
null
)
27
{
28
$this->timer += (hrtime(
true
) -
$this->start
)/1e+9;
29
$this->
start
=
null
;
30
}
31
32
return
$this->
get
();
33
}
34
35
public
function
reset
(): static
36
{
37
return
$this->
set
(0.0);
38
}
39
40
public
function
flyback
(): float
41
{
42
$time
= $this->
stop
();
43
$this->
reset
();
44
$this->
start
();
45
46
return
$time
;
47
}
48
49
public
function
set
(
float
$timer
): static
50
{
51
$this->timer =
$timer
;
52
$this->
start
=
null
;
53
54
return
$this;
55
}
56
57
public
function
get
(): float
58
{
59
return
round($this->timer, $this->precision);
60
}
61
}
Bitrix\Main\Diag\StopWatch
Определения
stopwatch.php:6
Bitrix\Main\Diag\StopWatch\$start
float $start
Определения
stopwatch.php:8
Bitrix\Main\Diag\StopWatch\reset
reset()
Определения
stopwatch.php:35
Bitrix\Main\Diag\StopWatch\flyback
flyback()
Определения
stopwatch.php:40
Bitrix\Main\Diag\StopWatch\stop
stop()
Определения
stopwatch.php:24
Bitrix\Main\Diag\StopWatch\$timer
float $timer
Определения
stopwatch.php:9
Bitrix\Main\Diag\StopWatch\$precision
int $precision
Определения
stopwatch.php:10
Bitrix\Main\Diag\StopWatch\__construct
__construct(int $precision=6)
Определения
stopwatch.php:12
Bitrix\Main\Diag\StopWatch\start
start()
Определения
stopwatch.php:17
$time
$time
Определения
payment.php:61
bitrix
modules
main
lib
diag
stopwatch.php
Создано системой
1.14.0