@@ -22,21 +22,29 @@ final class GarbageCollectorStatus
22
22
private readonly int $ collected ;
23
23
private readonly int $ threshold ;
24
24
private readonly int $ roots ;
25
+ private readonly ?float $ applicationTime ;
26
+ private readonly ?float $ collectorTime ;
27
+ private readonly ?float $ destructorTime ;
28
+ private readonly ?float $ freeTime ;
25
29
private readonly ?bool $ running ;
26
30
private readonly ?bool $ protected ;
27
31
private readonly ?bool $ full ;
28
32
private readonly ?int $ bufferSize ;
29
33
30
- public function __construct (int $ runs , int $ collected , int $ threshold , int $ roots , ?bool $ running , ?bool $ protected , ?bool $ full , ?int $ bufferSize )
34
+ public function __construct (int $ runs , int $ collected , int $ threshold , int $ roots , ?float $ applicationTime , ? float $ collectorTime , ? float $ destructorTime , ? float $ freeTime , ? bool $ running , ?bool $ protected , ?bool $ full , ?int $ bufferSize )
31
35
{
32
- $ this ->runs = $ runs ;
33
- $ this ->collected = $ collected ;
34
- $ this ->threshold = $ threshold ;
35
- $ this ->roots = $ roots ;
36
- $ this ->running = $ running ;
37
- $ this ->protected = $ protected ;
38
- $ this ->full = $ full ;
39
- $ this ->bufferSize = $ bufferSize ;
36
+ $ this ->runs = $ runs ;
37
+ $ this ->collected = $ collected ;
38
+ $ this ->threshold = $ threshold ;
39
+ $ this ->roots = $ roots ;
40
+ $ this ->applicationTime = $ applicationTime ;
41
+ $ this ->collectorTime = $ collectorTime ;
42
+ $ this ->destructorTime = $ destructorTime ;
43
+ $ this ->freeTime = $ freeTime ;
44
+ $ this ->running = $ running ;
45
+ $ this ->protected = $ protected ;
46
+ $ this ->full = $ full ;
47
+ $ this ->bufferSize = $ bufferSize ;
40
48
}
41
49
42
50
public function runs (): int
@@ -60,6 +68,10 @@ public function roots(): int
60
68
}
61
69
62
70
/**
71
+ * @psalm-assert-if-true !null $this->applicationTime
72
+ * @psalm-assert-if-true !null $this->collectorTime
73
+ * @psalm-assert-if-true !null $this->destructorTime
74
+ * @psalm-assert-if-true !null $this->freeTime
63
75
* @psalm-assert-if-true !null $this->running
64
76
* @psalm-assert-if-true !null $this->protected
65
77
* @psalm-assert-if-true !null $this->full
@@ -70,6 +82,54 @@ public function hasExtendedInformation(): bool
70
82
return $ this ->running !== null ;
71
83
}
72
84
85
+ /**
86
+ * @throws RuntimeException on PHP < 8.3
87
+ */
88
+ public function applicationTime (): float
89
+ {
90
+ if ($ this ->applicationTime === null ) {
91
+ throw new RuntimeException ('Information not available ' );
92
+ }
93
+
94
+ return $ this ->applicationTime ;
95
+ }
96
+
97
+ /**
98
+ * @throws RuntimeException on PHP < 8.3
99
+ */
100
+ public function collectorTime (): float
101
+ {
102
+ if ($ this ->collectorTime === null ) {
103
+ throw new RuntimeException ('Information not available ' );
104
+ }
105
+
106
+ return $ this ->collectorTime ;
107
+ }
108
+
109
+ /**
110
+ * @throws RuntimeException on PHP < 8.3
111
+ */
112
+ public function destructorTime (): float
113
+ {
114
+ if ($ this ->destructorTime === null ) {
115
+ throw new RuntimeException ('Information not available ' );
116
+ }
117
+
118
+ return $ this ->destructorTime ;
119
+ }
120
+
121
+ /**
122
+ * @throws RuntimeException on PHP < 8.3
123
+ */
124
+ public function freeTime (): float
125
+ {
126
+ if ($ this ->freeTime === null ) {
127
+ throw new RuntimeException ('Information not available ' );
128
+ }
129
+
130
+ return $ this ->freeTime ;
131
+ }
132
+
73
133
/**
74
134
* @throws RuntimeException on PHP < 8.3
75
135
*/
0 commit comments