perf_hooks: remove less useful bootstrap marks · nodejs/node@a3fd1cd · GitHub
Skip to content

Commit a3fd1cd

Browse files
jasnelltargos
authored andcommitted
perf_hooks: remove less useful bootstrap marks
While `perf_hooks` is still in experimental, remove less useful bootstrap milestones. PR-URL: #21247 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
1 parent 8fddf59 commit a3fd1cd

5 files changed

Lines changed: 6 additions & 190 deletions

File tree

doc/api/perf_hooks.md

Lines changed: 0 additions & 78 deletions

lib/internal/bootstrap/node.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@
6868
const perf = process.binding('performance');
6969
const {
7070
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
71-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START,
72-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END,
73-
NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START,
74-
NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END,
75-
NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START,
76-
NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END,
77-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START,
78-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END
7971
} = perf.constants;
8072

8173
_process.setup_hrtime(_hrtime);
@@ -189,9 +181,7 @@
189181
// one to drop a file lib/_third_party_main.js into the build
190182
// directory which will be executed instead of Node's normal loading.
191183
process.nextTick(function() {
192-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
193184
NativeModule.require('_third_party_main');
194-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
195185
});
196186
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
197187
if (process.argv[1] === 'debug') {
@@ -214,44 +204,30 @@
214204
// channel. This needs to be done before any user code gets executed
215205
// (including preload modules).
216206
if (process.argv[1] && process.env.NODE_UNIQUE_ID) {
217-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START);
218207
const cluster = NativeModule.require('cluster');
219208
cluster._setupWorker();
220-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END);
221209
// Make sure it's not accidentally inherited by child processes.
222210
delete process.env.NODE_UNIQUE_ID;
223211
}
224212

225213
if (process._eval != null && !process._forceRepl) {
226-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
227-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
228214
// User passed '-e' or '--eval' arguments to Node without '-i' or
229215
// '--interactive'.
230-
231-
perf.markMilestone(
232-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START);
233216
preloadModules();
234-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
235217

236218
const {
237219
addBuiltinLibsToObject
238220
} = NativeModule.require('internal/modules/cjs/helpers');
239221
addBuiltinLibsToObject(global);
240222
evalScript('[eval]');
241223
} else if (process.argv[1] && process.argv[1] !== '-') {
242-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
243224
// Make process.argv[1] into a full path.
244225
const path = NativeModule.require('path');
245226
process.argv[1] = path.resolve(process.argv[1]);
246227

247228
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
248229

249-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
250-
perf.markMilestone(
251-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START);
252230
preloadModules();
253-
perf.markMilestone(
254-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
255231
// Check if user passed `-c` or `--check` arguments to Node.
256232
if (process._syntax_check_only != null) {
257233
const fs = NativeModule.require('fs');
@@ -263,13 +239,7 @@
263239
}
264240
CJSModule.runMain();
265241
} else {
266-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
267-
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
268-
perf.markMilestone(
269-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START);
270242
preloadModules();
271-
perf.markMilestone(
272-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
273243
// If -i or --interactive were passed, or stdin is a TTY.
274244
if (process._forceRepl || NativeModule.require('tty').isatty(0)) {
275245
// REPL

lib/perf_hooks.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,7 @@ const {
2727
NODE_PERFORMANCE_MILESTONE_LOOP_START,
2828
NODE_PERFORMANCE_MILESTONE_LOOP_EXIT,
2929
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
30-
NODE_PERFORMANCE_MILESTONE_ENVIRONMENT,
31-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START,
32-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END,
33-
NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START,
34-
NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END,
35-
NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START,
36-
NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END,
37-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START,
38-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END
30+
NODE_PERFORMANCE_MILESTONE_ENVIRONMENT
3931
} = constants;
4032

4133
const { AsyncResource } = require('async_hooks');
@@ -192,43 +184,6 @@ class PerformanceNodeTiming {
192184
return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
193185
}
194186

195-
get thirdPartyMainStart() {
196-
return getMilestoneTimestamp(
197-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
198-
}
199-
200-
get thirdPartyMainEnd() {
201-
return getMilestoneTimestamp(
202-
NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
203-
}
204-
205-
get clusterSetupStart() {
206-
return getMilestoneTimestamp(
207-
NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START);
208-
}
209-
210-
get clusterSetupEnd() {
211-
return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END);
212-
}
213-
214-
get moduleLoadStart() {
215-
return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
216-
}
217-
218-
get moduleLoadEnd() {
219-
return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
220-
}
221-
222-
get preloadModuleLoadStart() {
223-
return getMilestoneTimestamp(
224-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START);
225-
}
226-
227-
get preloadModuleLoadEnd() {
228-
return getMilestoneTimestamp(
229-
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
230-
}
231-
232187
[kInspect]() {
233188
return {
234189
name: 'node',

src/node_perf_common.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,8 @@ extern uint64_t performance_v8_start;
2424
V(V8_START, "v8Start") \
2525
V(LOOP_START, "loopStart") \
2626
V(LOOP_EXIT, "loopExit") \
27-
V(BOOTSTRAP_COMPLETE, "bootstrapComplete") \
28-
V(THIRD_PARTY_MAIN_START, "thirdPartyMainStart") \
29-
V(THIRD_PARTY_MAIN_END, "thirdPartyMainEnd") \
30-
V(CLUSTER_SETUP_START, "clusterSetupStart") \
31-
V(CLUSTER_SETUP_END, "clusterSetupEnd") \
32-
V(MODULE_LOAD_START, "moduleLoadStart") \
33-
V(MODULE_LOAD_END, "moduleLoadEnd") \
34-
V(PRELOAD_MODULE_LOAD_START, "preloadModulesLoadStart") \
35-
V(PRELOAD_MODULE_LOAD_END, "preloadModulesLoadEnd")
27+
V(BOOTSTRAP_COMPLETE, "bootstrapComplete")
28+
3629

3730
#define NODE_PERFORMANCE_ENTRY_TYPES(V) \
3831
V(NODE, "node") \

test/sequential/test-performance.js

Lines changed: 3 additions & 27 deletions

0 commit comments

Comments
 (0)