mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: add loop idle time in diagnostic report
Add libuv's cumulative idle time in the diagnostic report. Add the data under the libuv's loop section Refs: https://github.com/nodejs/node/pull/34938 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
@@ -292,7 +292,8 @@ is provided below for reference.
|
||||
{
|
||||
"type": "loop",
|
||||
"is_active": true,
|
||||
"address": "0x000055fc7b2cb180"
|
||||
"address": "0x000055fc7b2cb180",
|
||||
"loopIdleTimeSeconds": 22644.8
|
||||
}
|
||||
],
|
||||
"workers": [],
|
||||
|
||||
@@ -294,6 +294,10 @@ static void WriteNodeReport(Isolate* isolate,
|
||||
static_cast<bool>(uv_loop_alive(env->event_loop())));
|
||||
writer.json_keyvalue("address",
|
||||
ValueToHexString(reinterpret_cast<int64_t>(env->event_loop())));
|
||||
|
||||
// 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);
|
||||
writer.json_end();
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@ if (process.argv[2] === 'child') {
|
||||
assert.strictEqual(handle.filename, expected_filename);
|
||||
assert(handle.is_referenced);
|
||||
}),
|
||||
loop: common.mustCall(function loop_validator(handle) {
|
||||
assert.strictEqual(typeof handle.loopIdleTimeSeconds, 'number');
|
||||
}),
|
||||
pipe: common.mustCallAtLeast(function pipe_validator(handle) {
|
||||
assert(handle.is_referenced);
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user