-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
src: add sync trace to fs #19649
src: add sync trace to fs #19649
Conversation
@nodejs/fs |
src/node_file.cc
Outdated
@@ -776,7 +815,9 @@ void Access(const FunctionCallbackInfo<Value>& args) { | |||
} else { // access(path, mode, undefined, ctx) | |||
CHECK_EQ(argc, 4); | |||
fs_req_wrap req_wrap; | |||
FS_SYNC_TRACE_BEGIN(SYNC_TRACE_ACCESS); | |||
SyncCall(env, args[3], &req_wrap, "access", uv_fs_access, *path, mode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe pass this as a parameter to SyncCall
and call FS_SYNC_TRACE_BEGIN
and FS_SYNC_TRACE_END
from there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the comment. I also considered adding trace begin and end into SyncCall. These trace functions are flexible to take additional useful tracing data whenever making sense such as number of bytes read for read(). Since SyncCall is already a variadic function, it will be a little messy to introduce arbitrary trace arguments there. It seems cleaner to leave SyncCall API unchanged and call trace begin and end variadic functions separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chinhuang007 Good point, I missed the call below that passes additional arguments to the macros, sorry about that.
9ab8e6a
to
f77f35e
Compare
f77f35e
to
79d3738
Compare
I fixed the conflicts in src/node_file.cc. Can someone start a new CI please? |
79d3738
to
a8fd0fc
Compare
08bccce
to
812a9c7
Compare
Another new CI to help the problem investigation: https://ci.nodejs.org/job/node-test-commit/17366/ |
a963af0
to
4f5d1fe
Compare
Thanks. Most CI issues were fixed by avoid using relative paths. Also found and fixed the AIX issues. Please start a new CI. |
029097a
to
1bd5f51
Compare
src/node_file.cc
Outdated
static const char* SYNC_TRACE_SYMLINK = "fs.symlink"; | ||
static const char* SYNC_TRACE_UNLINK = "fs.unlink"; | ||
static const char* SYNC_TRACE_UTIME = "fs.utimes"; | ||
static const char* SYNC_TRACE_WRITE = "fs.write"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to not have to define these as static strings this way and just build it in to the macro such that, for instance, FS_SYNC_TRACE_BEGIN(access)
would expand out to fs.access
8a8c31d
to
b266ed0
Compare
I merged with upstream, fixed the lint issue, and changed to use macros instead of static strings as @jasnell commented. Can someone start a CI? |
test/parallel/test-sync-trace-fs.js
Outdated
@@ -0,0 +1,161 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To group this better with other trace event test cases, please use a file name like test-trace-events-fs-sync.js
@joyeecheung Thanks for the heads-up. I just rebased my master and this branch and passed local tests. Can someone start an CI to see if everything is good? |
CI passed all tests except on linux-linked-debug, failing on test-http-readable-data-event, and on arm-fanned, failing on Waiting for next available executor on pi1-docker. Both seem unrelated to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
New CI since we are trying to have green CI before landing: https://ci.nodejs.org/job/node-test-pull-request/14233/ |
CI failures appear unrelated. |
Add sync trace to fs operations which is enabled by the node.fs.sync trace event category. Also add a general test js file to verify all operations. PR-URL: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Landed in 09c6346 |
Add sync trace to fs operations which is enabled by the node.fs.sync trace event category. Also add a general test js file to verify all operations. PR-URL: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Add the trace category for file system synchronous methods to documentation so the users can enable it when they want to look into file system sync method trace data. Refs: nodejs#19649
Add the trace category for file system synchronous methods to documentation so the users can enable it when they want to look into file system sync method trace data. PR-URL: #20526 Refs: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add the trace category for file system synchronous methods to documentation so the users can enable it when they want to look into file system sync method trace data. PR-URL: #20526 Refs: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add the trace category for file system synchronous methods to documentation so the users can enable it when they want to look into file system sync method trace data. PR-URL: #20526 Refs: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add the trace category for file system synchronous methods to documentation so the users can enable it when they want to look into file system sync method trace data. PR-URL: #20526 Refs: #19649 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add sync trace to fs operations which
is enabled by the node.fs.sync trace event
category. Also add a general test js file
to verify all operations.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes