From 81ea507e8ef0e2ef39d2880c01c947620f04c17a Mon Sep 17 00:00:00 2001 From: daomingq Date: Tue, 13 Sep 2022 22:14:39 +0800 Subject: [PATCH] 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. PR-URL: https://github.com/nodejs/node/pull/44534 Reviewed-By: Anna Henningsen --- src/api/environment.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/environment.cc b/src/api/environment.cc index 01e25d3f92a49f..315e5c1d03a59d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -768,6 +768,7 @@ ThreadId AllocateEnvironmentThreadId() { void DefaultProcessExitHandler(Environment* env, int exit_code) { env->set_can_call_into_js(false); env->stop_sub_worker_contexts(); + env->isolate()->DumpAndResetStats(); DisposePlatform(); uv_library_shutdown(); exit(exit_code);