Skip to content

Commit

Permalink
perf_hooks: set bootstrap complete in only one place
Browse files Browse the repository at this point in the history
PR-URL: #21247
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
  • Loading branch information
jasnell authored and targos committed Jun 16, 2018
1 parent 9981220 commit 8fddf59
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
}
}

perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);

// There are various modes that Node can run in. The most common two
// are running from a script and running the REPL - but there are a few
// others like the debugger or running --eval arguments. Here we decide
Expand All @@ -186,7 +188,6 @@
// 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');
Expand All @@ -200,13 +201,11 @@
}

// 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 @@ -238,7 +237,6 @@
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 @@ -263,7 +261,6 @@
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 @@ -294,7 +291,6 @@

if (process._eval != null) {
// User passed '-e' or '--eval'
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
evalScript('[eval]');
}
} else {
Expand All @@ -311,14 +307,12 @@
checkScriptSyntax(code, '[stdin]');
} else {
process._eval = code;
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
evalScript('[stdin]');
}
});
}
}
}
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
}

function setupProcessObject() {
Expand Down

0 comments on commit 8fddf59

Please sign in to comment.