Skip to content

Commit 456a819

Browse files
committed
perf_hooks: always set bootstrapComplete
PR-URL: #20768 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent becc3ec commit 456a819

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/internal/bootstrap/node.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@
158158
// To allow people to extend Node in different ways, this hook allows
159159
// one to drop a file lib/_third_party_main.js into the build
160160
// directory which will be executed instead of Node's normal loading.
161+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
161162
process.nextTick(function() {
162163
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
163164
NativeModule.require('_third_party_main');
164165
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
165166
});
166-
167167
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
168168
if (process.argv[1] === 'debug') {
169169
process.emitWarning(
@@ -172,13 +172,14 @@
172172
}
173173

174174
// Start the debugger agent.
175+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
175176
process.nextTick(function() {
176177
NativeModule.require('internal/deps/node-inspect/lib/_inspect').start();
177178
});
178179

179180
} else if (process.profProcess) {
181+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
180182
NativeModule.require('internal/v8_prof_processor');
181-
182183
} else {
183184
// There is user code to be run.
184185

@@ -209,6 +210,7 @@
209210
addBuiltinLibsToObject
210211
} = NativeModule.require('internal/modules/cjs/helpers');
211212
addBuiltinLibsToObject(global);
213+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
212214
evalScript('[eval]');
213215
} else if (process.argv[1] && process.argv[1] !== '-') {
214216
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -233,6 +235,7 @@
233235
checkScriptSyntax(source, filename);
234236
process.exit(0);
235237
}
238+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
236239
CJSModule.runMain();
237240
} else {
238241
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -263,6 +266,7 @@
263266

264267
if (process._eval != null) {
265268
// User passed '-e' or '--eval'
269+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
266270
evalScript('[eval]');
267271
}
268272
} else {
@@ -279,6 +283,7 @@
279283
checkScriptSyntax(code, '[stdin]');
280284
} else {
281285
process._eval = code;
286+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
282287
evalScript('[stdin]');
283288
}
284289
});

test/sequential/test-performance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ checkNodeTiming({
7474
duration: { around: performance.now() },
7575
nodeStart: { around: 0 },
7676
v8Start: { around: 0 },
77-
bootstrapComplete: -1,
77+
bootstrapComplete: { around: inited },
7878
environment: { around: 0 },
7979
loopStart: -1,
8080
loopExit: -1,

0 commit comments

Comments
 (0)