Skip to content

v8: implement v8.takeCoverage() and v8.stopCoverage()

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++.

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.

cc @atian25

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading