mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
v8: export cpu_profiler_metadata_size in getHeapCodeStatistics
PR-URL: https://github.com/nodejs/node/pull/42818 Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
27ecf1d94c
commit
000a0c853b
@ -41,11 +41,14 @@ added: v12.8.0
|
||||
|
||||
* Returns: {Object}
|
||||
|
||||
Returns an object with the following properties:
|
||||
Get statistics about code and its metadata in the heap, see V8
|
||||
[`GetHeapCodeAndMetadataStatistics`][] API. Returns an object with the
|
||||
following properties:
|
||||
|
||||
* `code_and_metadata_size` {number}
|
||||
* `bytecode_and_metadata_size` {number}
|
||||
* `external_script_source_size` {number}
|
||||
* `cpu_profiler_metadata_size` {number}
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
@ -53,7 +56,8 @@ Returns an object with the following properties:
|
||||
{
|
||||
code_and_metadata_size: 212208,
|
||||
bytecode_and_metadata_size: 161368,
|
||||
external_script_source_size: 1410794
|
||||
external_script_source_size: 1410794,
|
||||
cpu_profiler_metadata_size: 0,
|
||||
}
|
||||
```
|
||||
|
||||
@ -882,6 +886,7 @@ occur synchronously in the case of `Promise.resolve()` or `Promise.reject()`.
|
||||
[`Deserializer`]: #class-v8deserializer
|
||||
[`ERR_BUFFER_TOO_LARGE`]: errors.md#err_buffer_too_large
|
||||
[`Error`]: errors.md#class-error
|
||||
[`GetHeapCodeAndMetadataStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866
|
||||
[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4
|
||||
[`NODE_V8_COVERAGE`]: cli.md#node_v8_coveragedir
|
||||
[`Serializer`]: #class-v8serializer
|
||||
|
@ -121,7 +121,8 @@ const {
|
||||
// Properties for heap code statistics buffer extraction.
|
||||
kCodeAndMetadataSizeIndex,
|
||||
kBytecodeAndMetadataSizeIndex,
|
||||
kExternalScriptSourceSizeIndex
|
||||
kExternalScriptSourceSizeIndex,
|
||||
kCPUProfilerMetaDataSizeIndex,
|
||||
} = binding;
|
||||
|
||||
const kNumberOfHeapSpaces = kHeapSpaces.length;
|
||||
@ -209,6 +210,7 @@ function getHeapSpaceStatistics() {
|
||||
* code_and_metadata_size: number;
|
||||
* bytecode_and_metadata_size: number;
|
||||
* external_script_source_size: number;
|
||||
* cpu_profiler_metadata_size: number;
|
||||
* }}
|
||||
*/
|
||||
function getHeapCodeStatistics() {
|
||||
@ -218,7 +220,8 @@ function getHeapCodeStatistics() {
|
||||
return {
|
||||
code_and_metadata_size: buffer[kCodeAndMetadataSizeIndex],
|
||||
bytecode_and_metadata_size: buffer[kBytecodeAndMetadataSizeIndex],
|
||||
external_script_source_size: buffer[kExternalScriptSourceSizeIndex]
|
||||
external_script_source_size: buffer[kExternalScriptSourceSizeIndex],
|
||||
cpu_profiler_metadata_size: buffer[kCPUProfilerMetaDataSizeIndex],
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ static constexpr size_t kHeapSpaceStatisticsPropertiesCount =
|
||||
#define HEAP_CODE_STATISTICS_PROPERTIES(V) \
|
||||
V(0, code_and_metadata_size, kCodeAndMetadataSizeIndex) \
|
||||
V(1, bytecode_and_metadata_size, kBytecodeAndMetadataSizeIndex) \
|
||||
V(2, external_script_source_size, kExternalScriptSourceSizeIndex)
|
||||
V(2, external_script_source_size, kExternalScriptSourceSizeIndex) \
|
||||
V(3, cpu_profiler_metadata_size, kCPUProfilerMetaDataSizeIndex)
|
||||
|
||||
#define V(a, b, c) +1
|
||||
static const size_t kHeapCodeStatisticsPropertiesCount =
|
||||
|
@ -29,6 +29,7 @@ const heapCodeStatistics = v8.getHeapCodeStatistics();
|
||||
const heapCodeStatisticsKeys = [
|
||||
'bytecode_and_metadata_size',
|
||||
'code_and_metadata_size',
|
||||
'cpu_profiler_metadata_size',
|
||||
'external_script_source_size'];
|
||||
assert.deepStrictEqual(Object.keys(heapCodeStatistics).sort(),
|
||||
heapCodeStatisticsKeys);
|
||||
|
Loading…
Reference in New Issue
Block a user