-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
src: add loop idle time in diagnostic report #35940
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Is this structural change (as opposed to just a new field) the sort of thing that should bump |
@richardlau - it is a new field addition, but that led to a structural change too. Original structure
|
I think the report version should be bumped. Can you also update the example report in the documentation. |
all - I have bumped the report version to 3, and reflected the change in the doc too. PTAL! |
Why do we not add this to the |
@addaleax - to confirm my understanding, are you proposing this style? "libuv": [
{
"type": "async",
"is_active": true,
"is_referenced": false,
"address": "0x0000000105a0bd70"
},
{
"loop_idle_time": 22644.8
}
] |
or I guess here, as an additional key-value pair: {
"type": "loop",
"is_active": true,
"address": "0x000055fc7b2cb180",
"loop_idle_time": 22644.8
} ? |
@gireeshpunathil Yes, the latter, for the |
78238da
to
516ec3d
Compare
@addaleax - done, ptal! |
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.
Maybe also add a validator for loop
to the uv handles test to assert the new field is present and a number?
node/test/report/test-report-uv-handles.js
Lines 119 to 171 in 9dbde1d
// Functions are named to aid debugging when they are not called. | |
const validators = { | |
fs_event: common.mustCall(function fs_event_validator(handle) { | |
if (!child_data.skip_fs_watch) { | |
assert.strictEqual(handle.filename, expected_filename); | |
assert(handle.is_referenced); | |
} | |
}), | |
fs_poll: common.mustCall(function fs_poll_validator(handle) { | |
assert.strictEqual(handle.filename, expected_filename); | |
assert(handle.is_referenced); | |
}), | |
pipe: common.mustCallAtLeast(function pipe_validator(handle) { | |
assert(handle.is_referenced); | |
}), | |
process: common.mustCall(function process_validator(handle) { | |
assert.strictEqual(handle.pid, child_data.pid); | |
assert(handle.is_referenced); | |
}), | |
tcp: common.mustCall(function tcp_validator(handle) { | |
// TCP handles. The report should contain three sockets: | |
// 1. The server's listening socket. | |
// 2. The inbound socket making the request. | |
// 3. The outbound socket sending the response. | |
const port = child_data.tcp_address.port; | |
if (handle.localEndpoint.port === port) { | |
if (handle.remoteEndpoint === null) { | |
found_tcp.push('listening'); | |
} else { | |
found_tcp.push('inbound'); | |
} | |
} else if (handle.remoteEndpoint.port === port) { | |
found_tcp.push('outbound'); | |
} | |
assert(handle.is_referenced); | |
}, 3), | |
timer: common.mustCallAtLeast(function timer_validator(handle) { | |
assert(!handle.is_referenced); | |
assert.strictEqual(handle.repeat, 0); | |
}), | |
udp: common.mustCall(function udp_validator(handle) { | |
if (handle.remoteEndpoint === null) { | |
assert.strictEqual(handle.localEndpoint.port, | |
child_data.udp_address.port); | |
found_udp.push('unconnected'); | |
} else { | |
assert.strictEqual(handle.remoteEndpoint.port, | |
child_data.udp_address.port); | |
found_udp.push('connected'); | |
} | |
assert(handle.is_referenced); | |
}, 2), | |
}; |
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 but I think doc/api/report.md still needs the relevant example updated to include this? (and the missing semicolon added to the test per linter)
I'm just curious. Why add it as |
@trevnorris What would you suggest instead? Seconds were suggested by me because they match other existing fields in the diagnostic output, so we’re being a bit consistent here instead of using random units everywhere. |
@addaleax That's fine. I just noticed the field |
This comment has been minimized.
This comment has been minimized.
@richardlau @cjihrig @addaleax @Trott - PTAL! |
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 with one small question.
|
||
// Report Event loop idle time | ||
uint64_t idle_time = uv_metrics_idle_time(env->event_loop()); | ||
writer.json_keyvalue("loopIdleTimeSeconds", 1.0 * idle_time / 1e9); |
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.
Is idle_time
in nanoseconds? I thought @trevnorris said it was milliseconds in #35940 (comment).
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.
The libuv code uses uv_hrtime()
without any additional scaling, so, yes, nanoseconds.
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.
Lines 446 to 447 in 589b2a1
uint64_t idle_time = uv_metrics_idle_time(env->event_loop()); | |
args.GetReturnValue().Set(1.0 * idle_time / 1e6); |
this may make it very clear - the nanoseconds
that comes is converted to millis
if accessed through API.
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.
That makes sense. I was just confused by #35940 (comment). Thanks Anna and Gireesh.
https://ci.nodejs.org/job/node-test-binary-arm-12+/RUN_SUBSET=3,label=pi3-docker/8251/console the failure in |
Add libuv's cumulative idle time in the diagnostic report. Add the data under the libuv's loop section Refs: nodejs#34938 PR-URL: nodejs#35940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
b5ee125
to
74bd866
Compare
landed in 74bd866 |
Add libuv's cumulative idle time in the diagnostic report. Add the data under the libuv's loop section Refs: #34938 PR-URL: #35940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
Add libuv's cumulative idle time in the diagnostic report. Add the data under the libuv's loop section Refs: #34938 PR-URL: #35940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
Add libuv's cumulative idle time in the diagnostic report. Add the data under the libuv's loop section Refs: #34938 PR-URL: #35940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
Add libuv's cumulative idle time in the diagnostic report.
Modify the structure of libuv section to cater to this change
Refs: #34938
before
after
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes