File tree 4 files changed +13
-5
lines changed 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,23 @@ added: v12.8.0
41
41
42
42
* Returns: {Object}
43
43
44
- Returns an object with the following properties:
44
+ Get statistics about code and its metadata in the heap, see V8
45
+ ` GetHeapCodeAndMetadataStatistics ` API. Returns an object with the
46
+ following properties:
45
47
46
48
* ` code_and_metadata_size ` {number}
47
49
* ` bytecode_and_metadata_size ` {number}
48
50
* ` external_script_source_size ` {number}
51
+ * ` cpu_profiler_metadata_size ` {number}
49
52
50
53
<!-- eslint-skip -->
51
54
52
55
``` js
53
56
{
54
57
code_and_metadata_size: 212208 ,
55
58
bytecode_and_metadata_size: 161368 ,
56
- external_script_source_size: 1410794
59
+ external_script_source_size: 1410794 ,
60
+ cpu_profiler_metadata_size: 0
57
61
}
58
62
```
59
63
Original file line number Diff line number Diff line change @@ -118,7 +118,8 @@ const {
118
118
// Properties for heap code statistics buffer extraction.
119
119
kCodeAndMetadataSizeIndex,
120
120
kBytecodeAndMetadataSizeIndex,
121
- kExternalScriptSourceSizeIndex
121
+ kExternalScriptSourceSizeIndex,
122
+ kCPUProfilerMetaDataSizeIndex
122
123
} = binding ;
123
124
124
125
const kNumberOfHeapSpaces = kHeapSpaces . length ;
@@ -212,7 +213,8 @@ function getHeapCodeStatistics() {
212
213
return {
213
214
code_and_metadata_size : buffer [ kCodeAndMetadataSizeIndex ] ,
214
215
bytecode_and_metadata_size : buffer [ kBytecodeAndMetadataSizeIndex ] ,
215
- external_script_source_size : buffer [ kExternalScriptSourceSizeIndex ]
216
+ external_script_source_size : buffer [ kExternalScriptSourceSizeIndex ] ,
217
+ cpu_profiler_metadata_size : buffer [ kCPUProfilerMetaDataSizeIndex ]
216
218
} ;
217
219
}
218
220
Original file line number Diff line number Diff line change @@ -80,7 +80,8 @@ static constexpr size_t kHeapSpaceStatisticsPropertiesCount =
80
80
#define HEAP_CODE_STATISTICS_PROPERTIES (V ) \
81
81
V (0 , code_and_metadata_size, kCodeAndMetadataSizeIndex ) \
82
82
V (1 , bytecode_and_metadata_size, kBytecodeAndMetadataSizeIndex ) \
83
- V (2 , external_script_source_size, kExternalScriptSourceSizeIndex )
83
+ V (2 , external_script_source_size, kExternalScriptSourceSizeIndex ) \
84
+ V (3 , cpu_profiler_metadata_size, kCPUProfilerMetaDataSizeIndex )
84
85
85
86
#define V (a, b, c ) +1
86
87
static const size_t kHeapCodeStatisticsPropertiesCount =
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const heapCodeStatistics = v8.getHeapCodeStatistics();
26
26
const heapCodeStatisticsKeys = [
27
27
'bytecode_and_metadata_size' ,
28
28
'code_and_metadata_size' ,
29
+ 'cpu_profiler_metadata_size' ,
29
30
'external_script_source_size' ] ;
30
31
assert . deepStrictEqual ( Object . keys ( heapCodeStatistics ) . sort ( ) ,
31
32
heapCodeStatisticsKeys ) ;
You can’t perform that action at this time.
0 commit comments