Skip to content

Commit 8fddf59

Browse files
jasnelltargos
authored andcommitted
perf_hooks: set bootstrap complete in only one place
PR-URL: #21247 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent 9981220 commit 8fddf59

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/internal/bootstrap/node.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@
174174
}
175175
}
176176

177+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
178+
177179
// There are various modes that Node can run in. The most common two
178180
// are running from a script and running the REPL - but there are a few
179181
// others like the debugger or running --eval arguments. Here we decide
@@ -186,7 +188,6 @@
186188
// To allow people to extend Node in different ways, this hook allows
187189
// one to drop a file lib/_third_party_main.js into the build
188190
// directory which will be executed instead of Node's normal loading.
189-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
190191
process.nextTick(function() {
191192
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
192193
NativeModule.require('_third_party_main');
@@ -200,13 +201,11 @@
200201
}
201202

202203
// Start the debugger agent.
203-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
204204
process.nextTick(function() {
205205
NativeModule.require('internal/deps/node-inspect/lib/_inspect').start();
206206
});
207207

208208
} else if (process.profProcess) {
209-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
210209
NativeModule.require('internal/v8_prof_processor');
211210
} else {
212211
// There is user code to be run.
@@ -238,7 +237,6 @@
238237
addBuiltinLibsToObject
239238
} = NativeModule.require('internal/modules/cjs/helpers');
240239
addBuiltinLibsToObject(global);
241-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
242240
evalScript('[eval]');
243241
} else if (process.argv[1] && process.argv[1] !== '-') {
244242
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -263,7 +261,6 @@
263261
checkScriptSyntax(source, filename);
264262
process.exit(0);
265263
}
266-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
267264
CJSModule.runMain();
268265
} else {
269266
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -294,7 +291,6 @@
294291

295292
if (process._eval != null) {
296293
// User passed '-e' or '--eval'
297-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
298294
evalScript('[eval]');
299295
}
300296
} else {
@@ -311,14 +307,12 @@
311307
checkScriptSyntax(code, '[stdin]');
312308
} else {
313309
process._eval = code;
314-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
315310
evalScript('[stdin]');
316311
}
317312
});
318313
}
319314
}
320315
}
321-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
322316
}
323317

324318
function setupProcessObject() {

0 commit comments

Comments
 (0)