diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2020-06-09 16:18:25 +0300 |
---|---|---|
committer | gengjiawen <technicalcute@gmail.com> | 2020-10-22 13:53:36 +0300 |
commit | 7945a2cdc34623234037dfaccef56c257da68d13 (patch) | |
tree | 8030f573c3e83f0da49e0a00e36763c1f7aa2d18 /doc/api/v8.md | |
parent | fc5636e1eb45949e764f3b1ffbd63e39b2ca30a9 (diff) |
v8: implement v8.stopCoverage()
Add a v8.stopCoverage() API to stop the coverage collection
started by NODE_V8_COVERAGE - this would be useful in
conjunction with v8.takeCoverage() if the user don't want
to emit the coverage at the process exit but still want
to collect it on demand at some point.
PR-URL: https://github.com/nodejs/node/pull/33807
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Diffstat (limited to 'doc/api/v8.md')
-rw-r--r-- | doc/api/v8.md | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/api/v8.md b/doc/api/v8.md index acdc122ed6a..72556365291 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -227,7 +227,18 @@ be reset and a new coverage report will be written to the directory specified by [`NODE_V8_COVERAGE`][]. When the process is about to exit, one last coverage will still be written to -disk. +disk, unless [`v8.stopCoverage()`][] is invoked before the process exits. + +## `v8.stopCoverage()` + +<!-- YAML +added: REPLACEME +--> + +The `v8.stopCoverage()` method allows the user to stop the coverage collection +started by [`NODE_V8_COVERAGE`][], so that V8 can release the execution count +records and optimize code. This can be used in conjunction with +`v8.takeCoverage()` if the user wants to collect the coverage on demand. ## `v8.writeHeapSnapshot([filename])` <!-- YAML @@ -526,7 +537,7 @@ A subclass of [`Deserializer`][] corresponding to the format written by [`Deserializer`]: #v8_class_v8_deserializer [`Error`]: errors.md#errors_class_error [`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 -[`NODE_V8_COVERAGE`]: cli.html#cli_node_v8_coverage_dir +[`NODE_V8_COVERAGE`]: cli.md#cli_node_v8_coverage_dir [`Serializer`]: #v8_class_v8_serializer [`deserializer._readHostObject()`]: #v8_deserializer_readhostobject [`deserializer.transferArrayBuffer()`]: #v8_deserializer_transferarraybuffer_id_arraybuffer @@ -536,5 +547,6 @@ A subclass of [`Deserializer`][] corresponding to the format written by [`serializer.releaseBuffer()`]: #v8_serializer_releasebuffer [`serializer.transferArrayBuffer()`]: #v8_serializer_transferarraybuffer_id_arraybuffer [`serializer.writeRawBytes()`]: #v8_serializer_writerawbytes_buffer +[`v8.stopCoverage()`]: #v8_v8_stopcoverage [`vm.Script`]: vm.md#vm_new_vm_script_code_options [worker threads]: worker_threads.md |