Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf_hooks: always set bootstrapComplete #20768

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@
// To allow people to extend Node in different ways, this hook allows
// one to drop a file lib/_third_party_main.js into the build
// directory which will be executed instead of Node's normal loading.
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
process.nextTick(function() {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
NativeModule.require('_third_party_main');
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
});

} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
if (process.argv[1] === 'debug') {
process.emitWarning(
Expand All @@ -172,13 +172,14 @@
}

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

} else if (process.profProcess) {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
NativeModule.require('internal/v8_prof_processor');

} else {
// There is user code to be run.

Expand Down Expand Up @@ -209,6 +210,7 @@
addBuiltinLibsToObject
} = NativeModule.require('internal/modules/cjs/helpers');
addBuiltinLibsToObject(global);
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
evalScript('[eval]');
} else if (process.argv[1] && process.argv[1] !== '-') {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
Expand All @@ -233,6 +235,7 @@
checkScriptSyntax(source, filename);
process.exit(0);
}
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
CJSModule.runMain();
} else {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
Expand Down Expand Up @@ -263,6 +266,7 @@

if (process._eval != null) {
// User passed '-e' or '--eval'
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
evalScript('[eval]');
}
} else {
Expand All @@ -279,6 +283,7 @@
checkScriptSyntax(code, '[stdin]');
} else {
process._eval = code;
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
evalScript('[stdin]');
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ checkNodeTiming({
duration: { around: performance.now() },
nodeStart: { around: 0 },
v8Start: { around: 0 },
bootstrapComplete: -1,
bootstrapComplete: { around: inited },
environment: { around: 0 },
loopStart: -1,
loopExit: -1,
Expand Down