diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2020-06-09 20:46:52 +0800 |
---|---|---|
committer | Richard Lau <rlau@redhat.com> | 2021-03-17 20:35:54 +0000 |
commit | 8ddea3f16d643cb745e8ce75362d9be233bb42e1 (patch) | |
tree | 6086b4845788904f46d20830d2760d174800b481 /doc | |
parent | d7a4ccdf098f3a4f233d1c514fff0db3ddf0285a (diff) | |
download | node-new-8ddea3f16d643cb745e8ce75362d9be233bb42e1.tar.gz |
v8: implement v8.takeCoverage()
Add an v8.takeCoverage() API that allows the user to write the
coverage started by NODE_V8_COVERAGE to disk on demand.
The coverage can be written multiple times during the lifetime
of the process, each time the execution counter will be reset.
When the process is about to exit, one last coverage will
still be written to disk.
Also refactors the internal profiler connection code
so that we use the inspector response id to identify
the profile response instead of using an ad-hoc flag in C++.
PR-URL: https://github.com/nodejs/node/pull/33807
Backport-PR-URL: https://github.com/nodejs/node/pull/36352
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')
-rw-r--r-- | doc/api/v8.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/v8.md b/doc/api/v8.md index 921c437819..de4b9a37bd 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -214,6 +214,21 @@ v8.setFlagsFromString('--trace_gc'); setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); ``` +## `v8.takeCoverage()` + +<!-- YAML +added: REPLACEME +--> + +The `v8.takeCoverage()` method allows the user to write the coverage started by +[`NODE_V8_COVERAGE`][] to disk on demand. This method can be invoked multiple +times during the lifetime of the process, each time the execution counter will +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. + ## `v8.writeHeapSnapshot([filename])` <!-- YAML added: v11.13.0 @@ -509,6 +524,7 @@ A subclass of [`Deserializer`][] corresponding to the format written by [`Deserializer`]: #v8_class_v8_deserializer [`Error`]: errors.html#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 [`Serializer`]: #v8_class_v8_serializer [`deserializer._readHostObject()`]: #v8_deserializer_readhostobject [`deserializer.transferArrayBuffer()`]: #v8_deserializer_transferarraybuffer_id_arraybuffer |