Skip to content

Commit 2d4d87b

Browse files
committed
Fix perf_hooks profiling
nodejs/node#34938
1 parent 822152f commit 2d4d87b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

shell/app/node_main.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,13 @@ int NodeMain(int argc, char* argv[]) {
180180
gin::V8Initializer::LoadV8Snapshot(
181181
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
182182

183-
// V8 requires a task scheduler apparently
183+
// V8 requires a task scheduler.
184184
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Electron");
185185

186+
// Allow Node.js to track the amount of time the event loop has spent
187+
// idle in the kernel’s event provider .
188+
uv_loop_configure(loop, UV_METRICS_IDLE_TIME);
189+
186190
// Initialize gin::IsolateHolder.
187191
JavascriptEnvironment gin_env(loop);
188192

@@ -261,6 +265,8 @@ int NodeMain(int argc, char* argv[]) {
261265
{
262266
v8::SealHandleScope seal(isolate);
263267
bool more;
268+
env->performance_state()->Mark(
269+
node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_START);
264270
do {
265271
uv_run(env->event_loop(), UV_RUN_DEFAULT);
266272

@@ -278,6 +284,8 @@ int NodeMain(int argc, char* argv[]) {
278284
// event, or after running some callbacks.
279285
more = uv_loop_alive(env->event_loop());
280286
} while (more && !env->is_stopping());
287+
env->performance_state()->Mark(
288+
node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_EXIT);
281289
}
282290

283291
node_debugger.Stop();

0 commit comments

Comments
 (0)