Conversation
lib/perf_hooks.js
Outdated
There was a problem hiding this comment.
us? I think you want ns for nanoseconds, right?
(If I’m wrong: Can you spell ‘microseconds’ out? We can’t use µ in our source code because it’s not ASCII, but it might not be obvious to everybody that it’s the “American” spelling of µs.)
There was a problem hiding this comment.
You're right, this is counted in nanoseconds.
but it might not be obvious to everybody that it’s the “American” spelling of µs
Nah it's not the American spelling; it's the US spelling ;)
src/node_perf.cc
Outdated
There was a problem hiding this comment.
Is it guaranteed that the result of this call is compatible with uv_hrtime that we use for PERFORMANCE_NOW? I guess the test ensures that, but I feel like I’m missing something here…
There was a problem hiding this comment.
This is not compatible with ur_hrtime(), nor is it intended to be compatible. This function returns the real Unix time at which the function is called, while uv_hrtime() returns a monotonic timestamp based on some arbitrary time in the past.
The only place this is used is in the newly created timeOriginTimestamp global variable, to which performance.timeOrigin is set. performance.timeOrigin is intended to be a Unix timestamp (see #17893).
Further reading: a write-up for my userland implementation of performance, especially the last two paragraphs
apapirovski
left a comment
There was a problem hiding this comment.
Just a couple of very small things / questions, other than that LGTM.
src/node_perf_common.h
Outdated
There was a problem hiding this comment.
Is there a reason this is set to -1. and not -1? I'm far from a C++ expert so would love to better understand what's going if there is. Thanks!
There was a problem hiding this comment.
They are one and the same in this case. -1 (an integer literal) will get converted to a double anyway. I just wanted to make it explicit that we are assigning a floating point value -1 here.
There was a problem hiding this comment.
I figured that might've been the intention but wanted to make sure. Thanks.
test/parallel/test-performance.js
Outdated
There was a problem hiding this comment.
This has me just slightly concerned since it's somewhat arbitrary and the test is in parallel. Anything that can be done about that? I'm guessing not but figured would check...
There was a problem hiding this comment.
Not much, though this indeed failed on some Windows CIs. More relaxed bounds incoming.
8e8e09a to
497b54d
Compare
|
CI after fixing Windows (hopefully): https://ci.nodejs.org/job/node-test-pull-request/13522/ |
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
|
Landed in 9256dbb |
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892 Fixes: #17893 Fixes: #18992 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: nodejs#17892 Fixes: nodejs#17893 Fixes: nodejs#18992 PR-URL: nodejs#18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: nodejs#17892 Fixes: nodejs#17893 Fixes: nodejs#18992 PR-URL: nodejs#18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892 Fixes: #17893 Fixes: #18992 Backport-PR-URL: #22380 PR-URL: #18993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Fixes: #17892
Fixes: #17893
Fixes: #18992
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
perf_hooks