File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed
Expand file tree Collapse file tree 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
4141
4242* Returns: {Object}
4343
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:
4547
4648* ` code_and_metadata_size ` {number}
4749* ` bytecode_and_metadata_size ` {number}
4850* ` external_script_source_size ` {number}
51+ * ` cpu_profiler_metadata_size ` {number}
4952
5053<!-- eslint-skip -->
5154
5255``` js
5356{
5457 code_and_metadata_size: 212208 ,
5558 bytecode_and_metadata_size: 161368 ,
56- external_script_source_size: 1410794
59+ external_script_source_size: 1410794 ,
60+ cpu_profiler_metadata_size: 0
5761}
5862```
5963
Original file line number Diff line number Diff line change @@ -118,7 +118,8 @@ const {
118118 // Properties for heap code statistics buffer extraction.
119119 kCodeAndMetadataSizeIndex,
120120 kBytecodeAndMetadataSizeIndex,
121- kExternalScriptSourceSizeIndex
121+ kExternalScriptSourceSizeIndex,
122+ kCPUProfilerMetaDataSizeIndex
122123} = binding ;
123124
124125const kNumberOfHeapSpaces = kHeapSpaces . length ;
@@ -212,7 +213,8 @@ function getHeapCodeStatistics() {
212213 return {
213214 code_and_metadata_size : buffer [ kCodeAndMetadataSizeIndex ] ,
214215 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 ]
216218 } ;
217219}
218220
Original file line number Diff line number Diff line change @@ -80,7 +80,8 @@ static constexpr size_t kHeapSpaceStatisticsPropertiesCount =
8080#define HEAP_CODE_STATISTICS_PROPERTIES (V ) \
8181 V (0 , code_and_metadata_size, kCodeAndMetadataSizeIndex ) \
8282 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 )
8485
8586#define V (a, b, c ) +1
8687static const size_t kHeapCodeStatisticsPropertiesCount =
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const heapCodeStatistics = v8.getHeapCodeStatistics();
2626const heapCodeStatisticsKeys = [
2727 'bytecode_and_metadata_size' ,
2828 'code_and_metadata_size' ,
29+ 'cpu_profiler_metadata_size' ,
2930 'external_script_source_size' ] ;
3031assert . deepStrictEqual ( Object . keys ( heapCodeStatistics ) . sort ( ) ,
3132 heapCodeStatisticsKeys ) ;
You can’t perform that action at this time.
0 commit comments