Skip to content

Commit 2e99576

Browse files
jasnellMylesBorins
authored andcommitted
perf_hooks: always set bootstrapComplete
PR-URL: #20768 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 22f46e7 commit 2e99576

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/internal/bootstrap/node.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@
157157
// To allow people to extend Node in different ways, this hook allows
158158
// one to drop a file lib/_third_party_main.js into the build
159159
// directory which will be executed instead of Node's normal loading.
160+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
160161
process.nextTick(function() {
161162
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
162163
NativeModule.require('_third_party_main');
163164
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
164165
});
165-
166166
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
167167
if (process.argv[1] === 'debug') {
168168
process.emitWarning(
@@ -171,13 +171,14 @@
171171
}
172172

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

178179
} else if (process.profProcess) {
180+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
179181
NativeModule.require('internal/v8_prof_processor');
180-
181182
} else {
182183
// There is user code to be run.
183184

@@ -208,6 +209,7 @@
208209
addBuiltinLibsToObject
209210
} = NativeModule.require('internal/modules/cjs/helpers');
210211
addBuiltinLibsToObject(global);
212+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
211213
evalScript('[eval]');
212214
} else if (process.argv[1] && process.argv[1] !== '-') {
213215
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -232,6 +234,7 @@
232234
checkScriptSyntax(source, filename);
233235
process.exit(0);
234236
}
237+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
235238
CJSModule.runMain();
236239
} else {
237240
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -262,6 +265,7 @@
262265

263266
if (process._eval != null) {
264267
// User passed '-e' or '--eval'
268+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
265269
evalScript('[eval]');
266270
}
267271
} else {
@@ -278,6 +282,7 @@
278282
checkScriptSyntax(code, '[stdin]');
279283
} else {
280284
process._eval = code;
285+
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
281286
evalScript('[stdin]');
282287
}
283288
});

test/sequential/test-performance.js

+1-1
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)