| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| 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 | ||
@@ -882,6 +886,7 @@ occur synchronously in the case of `Promise.resolve()` or `Promise.reject()`. | |||
| 882 | 886 | [`Deserializer`]: #class-v8deserializer | |
| 883 | 887 | [`ERR_BUFFER_TOO_LARGE`]: errors.md#err_buffer_too_large | |
| 884 | 888 | [`Error`]: errors.md#class-error | |
| 889 | + [`GetHeapCodeAndMetadataStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866 | ||
| 885 | 890 | [`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 | |
| 886 | 891 | [`NODE_V8_COVERAGE`]: cli.md#node_v8_coveragedir | |
| 887 | 892 | [`Serializer`]: #class-v8serializer | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,7 +121,8 @@ const { | |||
| 121 | 121 | // Properties for heap code statistics buffer extraction. | |
| 122 | 122 | kCodeAndMetadataSizeIndex, | |
| 123 | 123 | kBytecodeAndMetadataSizeIndex, | |
| 124 | - kExternalScriptSourceSizeIndex | ||
| 124 | + kExternalScriptSourceSizeIndex, | ||
| 125 | + kCPUProfilerMetaDataSizeIndex, | ||
| 125 | 126 | } = binding; | |
| 126 | 127 | ||
| 127 | 128 | const kNumberOfHeapSpaces = kHeapSpaces.length; | |
@@ -209,6 +210,7 @@ function getHeapSpaceStatistics() { | |||
| 209 | 210 | * code_and_metadata_size: number; | |
| 210 | 211 | * bytecode_and_metadata_size: number; | |
| 211 | 212 | * external_script_source_size: number; | |
| 213 | + * cpu_profiler_metadata_size: number; | ||
| 212 | 214 | * }} | |
| 213 | 215 | */ | |
| 214 | 216 | function getHeapCodeStatistics() { | |
@@ -218,7 +220,8 @@ function getHeapCodeStatistics() { | |||
| 218 | 220 | return { | |
| 219 | 221 | code_and_metadata_size: buffer[kCodeAndMetadataSizeIndex], | |
| 220 | 222 | bytecode_and_metadata_size: buffer[kBytecodeAndMetadataSizeIndex], | |
| 221 | - external_script_source_size: buffer[kExternalScriptSourceSizeIndex] | ||
| 223 | + external_script_source_size: buffer[kExternalScriptSourceSizeIndex], | ||
| 224 | + cpu_profiler_metadata_size: buffer[kCPUProfilerMetaDataSizeIndex], | ||
| 222 | 225 | }; | |
| 223 | 226 | } | |
| 224 | 227 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,7 +82,8 @@ static constexpr size_t kHeapSpaceStatisticsPropertiesCount = | |||
| 82 | 82 | #define HEAP_CODE_STATISTICS_PROPERTIES(V) \ | |
| 83 | 83 | V(0, code_and_metadata_size, kCodeAndMetadataSizeIndex) \ | |
| 84 | 84 | V(1, bytecode_and_metadata_size, kBytecodeAndMetadataSizeIndex) \ | |
| 85 | - V(2, external_script_source_size, kExternalScriptSourceSizeIndex) | ||
| 85 | + V(2, external_script_source_size, kExternalScriptSourceSizeIndex) \ | ||
| 86 | + V(3, cpu_profiler_metadata_size, kCPUProfilerMetaDataSizeIndex) | ||
| 86 | 87 | ||
| 87 | 88 | #define V(a, b, c) +1 | |
| 88 | 89 | static const size_t kHeapCodeStatisticsPropertiesCount = | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ const heapCodeStatistics = v8.getHeapCodeStatistics(); | |||
| 29 | 29 | const heapCodeStatisticsKeys = [ | |
| 30 | 30 | 'bytecode_and_metadata_size', | |
| 31 | 31 | 'code_and_metadata_size', | |
| 32 | + 'cpu_profiler_metadata_size', | ||
| 32 | 33 | 'external_script_source_size']; | |
| 33 | 34 | assert.deepStrictEqual(Object.keys(heapCodeStatistics).sort(), | |
| 34 | 35 | heapCodeStatisticsKeys); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments