Closed
Description
- Version: master
- Platform: all
- Subsystem: perf_hooks
'use strict';
const { performance } = require('perf_hooks');
console.log(performance.getEntries());
setTimeout(() => {
console.log(performance.getEntries());
}, 1000);
prints
{ name: 'node',
entryType: 'node',
startTime: 134273200.382782,
duration: 58.63538497686386,
nodeStart: 134273200550404,
v8Start: 134273201139625,
bootstrapComplete: 0,
environment: 134273205489261,
loopStart: 0,
loopExit: 0,
thirdPartyMainStart: 0,
thirdPartyMainEnd: 0,
clusterSetupStart: 0,
clusterSetupEnd: 0,
moduleLoadStart: 134273255384838,
moduleLoadEnd: 134273255401652,
preloadModuleLoadStart: 134273255401823,
preloadModuleLoadEnd: 134273255431580 }
{ name: 'node',
entryType: 'node',
startTime: 134273200.382782,
duration: 1062.4414259791374,
nodeStart: 134273200550404,
v8Start: 134273201139625,
bootstrapComplete: 134273262038325,
environment: 134273205489261,
loopStart: 134273262039729,
loopExit: 0,
thirdPartyMainStart: 0,
thirdPartyMainEnd: 0,
clusterSetupStart: 0,
clusterSetupEnd: 0,
moduleLoadStart: 134273255384838,
moduleLoadEnd: 134273255401652,
preloadModuleLoadStart: 134273255401823,
preloadModuleLoadEnd: 134273255431580 }
startTime
should be 0-based.performance.now()
suffers an identical problem (performance.now() returns incorrect value #17892)- The Node.js-specific milestones have nanoseconds as units, while they should have milliseconds precision per docs.
- The 0 special value ("the milestone has not been reached") is not documented, and may conflict with valid values after issues 1 and 2 are fixed.