From 2ac118161bbd7d689f8b8bd9f13a0829e19c952a Mon Sep 17 00:00:00 2001 From: Daoming Qiu Date: Tue, 6 Sep 2022 16:03:51 +0800 Subject: [PATCH 1/2] src: dump isolate stats when process exits When process exits, dump v8 isolate's internal stats for performance evaluation and debugging. It fixed the incorrect profiling log output when running V8's builtin PGO profiling for node.js service type application,which exits by user pressing CTRL+C etc. keys. --- src/api/environment.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/environment.cc b/src/api/environment.cc index 9049b4617b9b18..2b7f8de5fcb946 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -778,6 +778,7 @@ ThreadId AllocateEnvironmentThreadId() { void DefaultProcessExitHandler(Environment* env, int exit_code) { env->set_can_call_into_js(false); env->stop_sub_worker_contexts(); + v8::Isolate::GetCurrent()->DumpAndResetStats(); DisposePlatform(); uv_library_shutdown(); exit(exit_code); From f5e0a65697288191f0322c232e6490efb254b70d Mon Sep 17 00:00:00 2001 From: daomingq Date: Tue, 6 Sep 2022 23:50:29 +0800 Subject: [PATCH 2/2] Update src/api/environment.cc Co-authored-by: Anna Henningsen --- src/api/environment.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/environment.cc b/src/api/environment.cc index 2b7f8de5fcb946..bf78ea6c06f455 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -778,7 +778,7 @@ ThreadId AllocateEnvironmentThreadId() { void DefaultProcessExitHandler(Environment* env, int exit_code) { env->set_can_call_into_js(false); env->stop_sub_worker_contexts(); - v8::Isolate::GetCurrent()->DumpAndResetStats(); + env->isolate()->DumpAndResetStats(); DisposePlatform(); uv_library_shutdown(); exit(exit_code);