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 <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent 8fddf59 commit a3fd1cd

File tree

5 files changed

+6
-190
lines changed

5 files changed

+6
-190
lines changed

doc/api/perf_hooks.md

-78
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,6 @@ The high resolution millisecond timestamp at which the Node.js process
219219
completed bootstrapping. If bootstrapping has not yet finished, the property
220220
has the value of -1.
221221

222-
### performanceNodeTiming.clusterSetupEnd
223-
<!-- YAML
224-
added: v8.5.0
225-
-->
226-
227-
* {number}
228-
229-
The high resolution millisecond timestamp at which cluster processing ended. If
230-
cluster processing has not yet ended, the property has the value of -1.
231-
232-
### performanceNodeTiming.clusterSetupStart
233-
<!-- YAML
234-
added: v8.5.0
235-
-->
236-
237-
* {number}
238-
239-
The high resolution millisecond timestamp at which cluster processing started.
240-
If cluster processing has not yet started, the property has the value of -1.
241-
242222
### performanceNodeTiming.loopExit
243223
<!-- YAML
244224
added: v8.5.0
@@ -261,24 +241,6 @@ The high resolution millisecond timestamp at which the Node.js event loop
261241
started. If the event loop has not yet started (e.g., in the first tick of the
262242
main script), the property has the value of -1.
263243

264-
### performanceNodeTiming.moduleLoadEnd
265-
<!-- YAML
266-
added: v8.5.0
267-
-->
268-
269-
* {number}
270-
271-
The high resolution millisecond timestamp at which main module load ended.
272-
273-
### performanceNodeTiming.moduleLoadStart
274-
<!-- YAML
275-
added: v8.5.0
276-
-->
277-
278-
* {number}
279-
280-
The high resolution millisecond timestamp at which main module load started.
281-
282244
### performanceNodeTiming.nodeStart
283245
<!-- YAML
284246
added: v8.5.0
@@ -289,46 +251,6 @@ added: v8.5.0
289251
The high resolution millisecond timestamp at which the Node.js process was
290252
initialized.
291253

292-
### performanceNodeTiming.preloadModuleLoadEnd
293-
<!-- YAML
294-
added: v8.5.0
295-
-->
296-
297-
* {number}
298-
299-
The high resolution millisecond timestamp at which preload module load ended.
300-
301-
### performanceNodeTiming.preloadModuleLoadStart
302-
<!-- YAML
303-
added: v8.5.0
304-
-->
305-
306-
* {number}
307-
308-
The high resolution millisecond timestamp at which preload module load started.
309-
310-
### performanceNodeTiming.thirdPartyMainEnd
311-
<!-- YAML
312-
added: v8.5.0
313-
-->
314-
315-
* {number}
316-
317-
The high resolution millisecond timestamp at which third\_party\_main
318-
processing ended. If third\_party\_main processing has not yet ended, the
319-
property has the value of -1.
320-
321-
### performanceNodeTiming.thirdPartyMainStart
322-
<!-- YAML
323-
added: v8.5.0
324-
-->
325-
326-
* {number}
327-
328-
The high resolution millisecond timestamp at which third\_party\_main
329-
processing started. If third\_party\_main processing has not yet started, the
330-
property has the value of -1.
331-
332254
### performanceNodeTiming.v8Start
333255
<!-- YAML
334256
added: v8.5.0

lib/internal/bootstrap/node.js

-30
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

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

+2-9
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

+3-27
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,7 @@ checkNodeTiming({
8080
bootstrapComplete: { around: inited },
8181
environment: { around: 0 },
8282
loopStart: -1,
83-
loopExit: -1,
84-
thirdPartyMainStart: -1,
85-
thirdPartyMainEnd: -1,
86-
clusterSetupStart: -1,
87-
clusterSetupEnd: -1,
88-
moduleLoadStart: { around: inited },
89-
moduleLoadEnd: { around: inited },
90-
preloadModuleLoadStart: { around: inited },
91-
preloadModuleLoadEnd: { around: inited },
83+
loopExit: -1
9284
});
9385

9486
setTimeout(() => {
@@ -102,15 +94,7 @@ setTimeout(() => {
10294
bootstrapComplete: { around: inited },
10395
environment: { around: 0 },
10496
loopStart: { around: inited },
105-
loopExit: -1,
106-
thirdPartyMainStart: -1,
107-
thirdPartyMainEnd: -1,
108-
clusterSetupStart: -1,
109-
clusterSetupEnd: -1,
110-
moduleLoadStart: { around: inited },
111-
moduleLoadEnd: { around: inited },
112-
preloadModuleLoadStart: { around: inited },
113-
preloadModuleLoadEnd: { around: inited },
97+
loopExit: -1
11498
});
11599
}, 2000);
116100

@@ -125,14 +109,6 @@ process.on('exit', () => {
125109
bootstrapComplete: { around: inited },
126110
environment: { around: 0 },
127111
loopStart: { around: inited },
128-
loopExit: { around: performance.now() },
129-
thirdPartyMainStart: -1,
130-
thirdPartyMainEnd: -1,
131-
clusterSetupStart: -1,
132-
clusterSetupEnd: -1,
133-
moduleLoadStart: { around: inited },
134-
moduleLoadEnd: { around: inited },
135-
preloadModuleLoadStart: { around: inited },
136-
preloadModuleLoadEnd: { around: inited },
112+
loopExit: { around: performance.now() }
137113
});
138114
});

0 commit comments

Comments
 (0)