Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 5094f76

Browse files
committed
Add number of native and detached ctxt to HeapStatistics, closes #84
1 parent a764fee commit 5094f76

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

src/HeapStatistics.php

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ class HeapStatistics
6060
* @var bool
6161
*/
6262
private $does_zap_garbage;
63+
/**
64+
* @var float
65+
*/
66+
private $number_of_native_contexts;
67+
/**
68+
* @var float
69+
*/
70+
private $number_of_detached_contexts;
6371

6472
/**
6573
* @param float $total_heap_size
@@ -69,7 +77,10 @@ class HeapStatistics
6977
* @param float $used_heap_size
7078
* @param float $heap_size_limit
7179
* @param float $malloced_memory
80+
* @param float $peak_malloced_memory
7281
* @param bool $does_zap_garbage
82+
* @param float $number_of_native_contexts
83+
* @param float $number_of_detached_contexts
7384
*/
7485
public function __construct(
7586
float $total_heap_size,
@@ -80,17 +91,21 @@ public function __construct(
8091
float $heap_size_limit,
8192
float $malloced_memory,
8293
float $peak_malloced_memory,
83-
bool $does_zap_garbage
94+
bool $does_zap_garbage,
95+
float $number_of_native_contexts,
96+
float $number_of_detached_contexts
8497
) {
85-
$this->total_heap_size = $total_heap_size;
86-
$this->total_heap_size_executable = $total_heap_size_executable;
87-
$this->total_physical_size = $total_physical_size;
88-
$this->total_available_size = $total_available_size;
89-
$this->used_heap_size = $used_heap_size;
90-
$this->heap_size_limit = $heap_size_limit;
91-
$this->malloced_memory = $malloced_memory;
92-
$this->peak_malloced_memory = $peak_malloced_memory;
93-
$this->does_zap_garbage = $does_zap_garbage;
98+
$this->total_heap_size = $total_heap_size;
99+
$this->total_heap_size_executable = $total_heap_size_executable;
100+
$this->total_physical_size = $total_physical_size;
101+
$this->total_available_size = $total_available_size;
102+
$this->used_heap_size = $used_heap_size;
103+
$this->heap_size_limit = $heap_size_limit;
104+
$this->malloced_memory = $malloced_memory;
105+
$this->peak_malloced_memory = $peak_malloced_memory;
106+
$this->does_zap_garbage = $does_zap_garbage;
107+
$this->number_of_native_contexts = $number_of_native_contexts;
108+
$this->number_of_detached_contexts = $number_of_detached_contexts;
94109
}
95110

96111
/**
@@ -166,4 +181,22 @@ public function doesZapGarbage(): bool
166181
{
167182
return $this->does_zap_garbage;
168183
}
184+
185+
/**
186+
* The total number of native contexts object on the heap
187+
* @return float
188+
*/
189+
public function getNumberOfNativeContexts(): float
190+
{
191+
return $this->number_of_native_contexts;
192+
}
193+
194+
/**
195+
* The total number of native contexts that were detached but were not garbage collected yet
196+
* @return float
197+
*/
198+
public function getNumberOfDetachedContexts(): float
199+
{
200+
return $this->number_of_detached_contexts;
201+
}
169202
}

0 commit comments

Comments
 (0)