Skip to content

performance.nodeTiming doesn't work as documented #18992

Description

@TimothyGu
  • 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 }
  1. startTime should be 0-based. performance.now() suffers an identical problem (performance.now() returns incorrect value #17892)
  2. The Node.js-specific milestones have nanoseconds as units, while they should have milliseconds precision per docs.
  3. 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.

Activity

  1. added
    perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.
    on Feb 25, 2018
  2. self-assigned this
    on Feb 25, 2018
  3. added a commit that references this issue on May 8, 2018
  4. added a commit that references this issue on Aug 17, 2018
  5. added a commit that references this issue on Sep 6, 2018
  6. added a commit that references this issue on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions