From 9460a298a744753ec16d42bb323f9896f139ca72 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 3 Jun 2018 16:30:15 -0700 Subject: [PATCH 1/3] perf_hooks: set bootstrap complete in only one place --- lib/internal/bootstrap/node.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 4817ec110a99e5..7b836b466f5d9c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -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 @@ -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'); @@ -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. @@ -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); @@ -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); @@ -294,7 +291,6 @@ if (process._eval != null) { // User passed '-e' or '--eval' - perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE); evalScript('[eval]'); } } else { @@ -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() { From 304b1ebf338443b375853b040bc91f1d5b583902 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 3 Jun 2018 16:58:48 -0700 Subject: [PATCH 2/3] perf_hooks: remove less useful bootstrap marks While `perf_hooks` is still in experimental, remove less useful bootstrap milestones. --- doc/api/perf_hooks.md | 80 +---------------------------- lib/internal/bootstrap/node.js | 30 ----------- lib/perf_hooks.js | 47 +---------------- src/node_perf_common.h | 11 +--- test/sequential/test-performance.js | 30 ++--------- 5 files changed, 7 insertions(+), 191 deletions(-) diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index a8c6bcf7378837..ecc71b4919848d 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -23,7 +23,7 @@ doSomeLongRunningProcess(() => { performance.mark('B'); performance.measure('A to B', 'A', 'B'); }); -``` +````` ## Class: Performance - -* {number} - -The high resolution millisecond timestamp at which cluster processing ended. If -cluster processing has not yet ended, the property has the value of -1. - -### performanceNodeTiming.clusterSetupStart - - -* {number} - -The high resolution millisecond timestamp at which cluster processing started. -If cluster processing has not yet started, the property has the value of -1. - ### performanceNodeTiming.loopExit - -* {number} - -The high resolution millisecond timestamp at which main module load ended. - -### performanceNodeTiming.moduleLoadStart - - -* {number} - -The high resolution millisecond timestamp at which main module load started. - ### performanceNodeTiming.nodeStart - -* {number} - -The high resolution millisecond timestamp at which preload module load ended. - -### performanceNodeTiming.preloadModuleLoadStart - - -* {number} - -The high resolution millisecond timestamp at which preload module load started. - -### performanceNodeTiming.thirdPartyMainEnd - - -* {number} - -The high resolution millisecond timestamp at which third\_party\_main -processing ended. If third\_party\_main processing has not yet ended, the -property has the value of -1. - -### performanceNodeTiming.thirdPartyMainStart - - -* {number} - -The high resolution millisecond timestamp at which third\_party\_main -processing started. If third\_party\_main processing has not yet started, the -property has the value of -1. - ### performanceNodeTiming.v8Start