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

src: add sync trace to fs #19649

Closed
wants to merge 1 commit into from

Conversation

chinhuang007
Copy link
Contributor

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
  • [x ] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x ] tests and/or benchmarks are included
  • [x ] commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. labels Mar 28, 2018
@Trott
Copy link
Member

Trott commented Mar 28, 2018

@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);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

@joyeecheung
Copy link
Member

@chinhuang007
Copy link
Contributor Author

I fixed the conflicts in src/node_file.cc. Can someone start a new CI please?

@joyeecheung
Copy link
Member

joyeecheung commented Mar 30, 2018

@yhwang
Copy link
Member

yhwang commented Apr 2, 2018

@chinhuang007 chinhuang007 force-pushed the add_fs_sync_trace branch 2 times, most recently from 08bccce to 812a9c7 Compare April 2, 2018 20:29
@yhwang
Copy link
Member

yhwang commented Apr 2, 2018

Another new CI to help the problem investigation: https://ci.nodejs.org/job/node-test-commit/17366/

@chinhuang007 chinhuang007 force-pushed the add_fs_sync_trace branch 4 times, most recently from a963af0 to 4f5d1fe Compare April 3, 2018 00:43
@chinhuang007
Copy link
Contributor Author

Thanks. Most CI issues were fixed by avoid using relative paths. Also found and fixed the AIX issues. Please start a new CI.

@yhwang
Copy link
Member

yhwang commented Apr 3, 2018

@chinhuang007 chinhuang007 force-pushed the add_fs_sync_trace branch 2 times, most recently from 029097a to 1bd5f51 Compare April 3, 2018 01:18
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";
Copy link
Member

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

@chinhuang007 chinhuang007 force-pushed the add_fs_sync_trace branch 4 times, most recently from 8a8c31d to b266ed0 Compare April 3, 2018 22:39
@chinhuang007
Copy link
Contributor Author

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?

@joyeecheung
Copy link
Member

@@ -0,0 +1,161 @@
'use strict';
Copy link
Member

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

@chinhuang007
Copy link
Contributor Author

@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?

@yhwang
Copy link
Member

yhwang commented Apr 9, 2018

@chinhuang007
Copy link
Contributor Author

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.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhdawson
Copy link
Member

New CI since we are trying to have green CI before landing: https://ci.nodejs.org/job/node-test-pull-request/14233/

@jasnell
Copy link
Member

jasnell commented Apr 14, 2018

CI failures appear unrelated.

jasnell pushed a commit that referenced this pull request Apr 14, 2018
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>
@jasnell
Copy link
Member

jasnell commented Apr 14, 2018

Landed in 09c6346

@jasnell jasnell closed this Apr 14, 2018
jasnell pushed a commit that referenced this pull request Apr 16, 2018
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>
@chinhuang007 chinhuang007 deleted the add_fs_sync_trace branch April 24, 2018 18:56
chinhuang007 added a commit to chinhuang007/node that referenced this pull request May 4, 2018
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
vsemozhetbyt pushed a commit that referenced this pull request May 8, 2018
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>
MylesBorins pushed a commit that referenced this pull request May 8, 2018
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>
MylesBorins pushed a commit that referenced this pull request May 8, 2018
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>
MylesBorins pushed a commit that referenced this pull request May 9, 2018
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants