diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2022-10-13 15:37:22 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2022-11-08 18:19:54 +0300 |
commit | b872d30d1956981f9579a564e601c94207f800ff (patch) | |
tree | b997ba399b7ff78b31dc20d318a0d1009a9a2d45 /doc/api | |
parent | 59938e3180d97440cd38eeb6ed816f99640a1511 (diff) |
lib: add options to the heap snapshot APIs
Support configuration of the HeapSnapshotMode and NumericsMode
fields inf HeapSnapshotOptions in the JS APIs for heap snapshots.
PR-URL: https://github.com/nodejs/node/pull/44989
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/v8.md | 24 | ||||
-rw-r--r-- | doc/api/worker_threads.md | 13 |
2 files changed, 32 insertions, 5 deletions
diff --git a/doc/api/v8.md b/doc/api/v8.md index ed63f44f01b..1d26ff953b4 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -61,13 +61,23 @@ following properties: } ``` -## `v8.getHeapSnapshot()` +## `v8.getHeapSnapshot([options])` <!-- YAML added: v11.13.0 +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/44989 + description: Support options to configure the heap snapshot. --> -* Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot +* `options` {Object} + * `exposeInternals` {boolean} If true, expose internals in the heap snapshot. + **Default:** `false`. + * `exposeNumericValues` {boolean} If true, expose numeric values in + artificial fields. **Default:** `false`. + +* Returns: {stream.Readable} A Readable containing the V8 heap snapshot. Generates a snapshot of the current V8 heap and returns a Readable Stream that may be used to read the JSON serialized representation. @@ -289,11 +299,14 @@ by [`NODE_V8_COVERAGE`][]. When the process is about to exit, one last coverage will still be written to disk unless [`v8.stopCoverage()`][] is invoked before the process exits. -## `v8.writeHeapSnapshot([filename])` +## `v8.writeHeapSnapshot([filename[,options]])` <!-- YAML added: v11.13.0 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/44989 + description: Support options to configure the heap snapshot. - version: v18.0.0 pr-url: https://github.com/nodejs/node/pull/41373 description: An exception will now be thrown if the file could not be written. @@ -308,6 +321,11 @@ changes: generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a worker thread. +* `options` {Object} + * `exposeInternals` {boolean} If true, expose internals in the heap snapshot. + **Default:** `false`. + * `exposeNumericValues` {boolean} If true, expose numeric values in + artificial fields. **Default:** `false`. * Returns: {string} The filename where the snapshot was saved. Generates a snapshot of the current V8 heap and writes it to a JSON diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 99772189522..694b1e74e06 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -1067,14 +1067,23 @@ added: v10.5.0 The `'online'` event is emitted when the worker thread has started executing JavaScript code. -### `worker.getHeapSnapshot()` +### `worker.getHeapSnapshot([options])` <!-- YAML added: - v13.9.0 - v12.17.0 +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/44989 + description: Support options to configure the heap snapshot. --> +* `options` {Object} + * `exposeInternals` {boolean} If true, expose internals in the heap snapshot. + **Default:** `false`. + * `exposeNumericValues` {boolean} If true, expose numeric values in + artificial fields. **Default:** `false`. * Returns: {Promise} A promise for a Readable Stream containing a V8 heap snapshot @@ -1379,7 +1388,7 @@ thread spawned will spawn another until the application crashes. [`require('node:worker_threads').threadId`]: #workerthreadid [`require('node:worker_threads').workerData`]: #workerworkerdata [`trace_events`]: tracing.md -[`v8.getHeapSnapshot()`]: v8.md#v8getheapsnapshot +[`v8.getHeapSnapshot()`]: v8.md#v8getheapsnapshotoptions [`vm`]: vm.md [`worker.SHARE_ENV`]: #workershare_env [`worker.on('message')`]: #event-message_1 |