From 07967f689aa64021bee509970cdb869ae5d202c8 Mon Sep 17 00:00:00 2001 From: Yuriy Vasiyarov Date: Thu, 30 May 2019 16:41:03 +0300 Subject: [PATCH] src: export v8.GetHeapCodeAndMetadataStatistics() Export statistic provided by V8 through HeapCodeStatistics class and and GetHeapCodeAndMetadataStatistics function to v8 Node.js module --- doc/api/v8.md | 22 +++++++++++++ lib/v8.js | 30 ++++++++++++++++-- src/env-inl.h | 10 ++++++ src/env.cc | 1 + src/env.h | 4 +++ src/node_v8.cc | 56 ++++++++++++++++++++++++++++++++++ test/parallel/test-v8-stats.js | 12 ++++++++ 7 files changed, 132 insertions(+), 3 deletions(-) diff --git a/doc/api/v8.md b/doc/api/v8.md index ab5950dda62c6a..f5d3bf41848287 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -166,6 +166,28 @@ being non-zero indicates a potential memory leak. } ``` +## v8.getHeapCodeStatistics() + + +* Returns: {Object} + +Returns an object with the following properties: + +* `code_and_metadata_size` {number} +* `bytecode_and_metadata_size` {number} +* `external_script_source_size` {number} + + +```js +{ + code_and_metadata_size: 212208, + bytecode_and_metadata_size: 161368, + external_script_source_size: 1410794 +} +``` + ## v8.setFlagsFromString(flags)