★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/32651Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf_hooks: allow omitted parameters in 'performance.measure' #32651

Closed
wants to merge 1 commit into from

Conversation

Copy link
Member

@Himself65 Himself65 commented Apr 4, 2020 •

FIxes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method

const { PerformanceObserver, performance } = require('perf_hooks');

const obs = new PerformanceObserver((items) => {
  console.log(items.getEntries()[0].duration);
  performance.clearMarks();
});
obs.observe({ entryTypes: ['measure'] });
performance.measure('Start to Now');

performance.mark('A');
doSomeLongRunningProcess(() => {
  performance.measure('A to Now', 'A');

  performance.mark('B');
  performance.measure('A to B', 'A', 'B');
});
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ perf_hooks labels Apr 4, 2020
@Himself65 Himself65 marked this pull request as ready for review Apr 4, 2020
Copy link
Member

@addaleax addaleax left a comment

This probably needs a changes: entry for the documentation and tests.

doc/api/perf_hooks.md Outdated Show resolved Hide resolved
@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Apr 4, 2020

This probably needs a changes: entry for the documentation and tests.

I have no idea how to add a test for these additions, any suggestions?

Copy link
Member

@addaleax addaleax left a comment

This probably needs a changes: entry for the documentation and tests.

I have no idea how to add a test for these additions, any suggestions?

Not really, because it isn’t quite obvious to me what exactly these changes end up doing.

doc/api/perf_hooks.md Outdated Show resolved Hide resolved
@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Apr 4, 2020 •

Not really, because it isn’t quite obvious to me what exactly these changes end up doing.

// test.js
const { PerformanceObserver, performance } = require('perf_hooks');

const obs = new PerformanceObserver((items) => {
  console.log(items.getEntries()[0].duration);
  performance.clearMarks();
});
obs.observe({ entryTypes: ['measure'] });

setTimeout(() => {
  performance.measure('Foo');
  performance.mark('B')
  performance.measure('to B', 'nodeStart', 'B');
}, 1000);
./Release/node.exe test.js
1029.4472
1033.832401

doc/api/perf_hooks.md Outdated Show resolved Hide resolved
@addaleax
Copy link
Member

@addaleax addaleax commented Apr 4, 2020

@Himself65 I guess that example could serve as the basis for a test then?

@Himself65 Himself65 force-pushed the 20200404-perf_hooks branch 3 times, most recently from bf42542 to b420270 Compare Apr 4, 2020
doc/api/perf_hooks.md Outdated Show resolved Hide resolved
doc/api/perf_hooks.md Outdated Show resolved Hide resolved
lib/perf_hooks.js Show resolved Hide resolved
@Himself65 Himself65 force-pushed the 20200404-perf_hooks branch 3 times, most recently from 0b38140 to f85faa4 Compare Apr 5, 2020
Copy link
Member

@addaleax addaleax left a comment

LGTM with tests added 👍

lib/perf_hooks.js Outdated Show resolved Hide resolved
@Himself65 Himself65 force-pushed the 20200404-perf_hooks branch 2 times, most recently from e9ec51a to 25bd57d Compare Apr 6, 2020
lib/perf_hooks.js Outdated Show resolved Hide resolved
Make `startMark` and `endMark` parameters optional.
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Apr 7, 2020

@Himself65 Himself65 added the author ready label Apr 9, 2020
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Apr 9, 2020

@Himself65 Himself65 self-assigned this Apr 10, 2020
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Apr 10, 2020

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Apr 10, 2020

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Apr 10, 2020 •

I think CI should all green but

image

They are old CI state, maybe some bug here

Himself65 added a commit to Himself65/node that referenced this issue Apr 10, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: nodejs#32651
Fixes: nodejs#32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Apr 10, 2020

Landed in d0a3bf1

@Himself65 Himself65 closed this Apr 10, 2020
@Himself65 Himself65 deleted the 20200404-perf_hooks branch Apr 10, 2020
targos pushed a commit that referenced this issue Apr 12, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
BethGriggs pushed a commit that referenced this issue Apr 14, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Apr 22, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready c++ perf_hooks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants