diff options
author | Andrey Pechkurov <apechkurov@gmail.com> | 2020-10-03 16:57:35 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-10-05 22:22:03 +0300 |
commit | 642f2064c06793b799959d7df0488f14df594181 (patch) | |
tree | 6163a241d6242e4090342ae36ea01e5fed7297a2 /doc/api/perf_hooks.md | |
parent | db4b0ecda74d964c3a791a27d1b18078b56db835 (diff) |
doc: improve eventLoopUtilization documentation
PR-URL: https://github.com/nodejs/node/pull/35479
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'doc/api/perf_hooks.md')
-rw-r--r-- | doc/api/perf_hooks.md | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 01e8597a51d..a6d9dfa9e95 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -58,9 +58,10 @@ Performance Timeline. If `name` is provided, removes only the named mark. added: v14.10.0 --> -* `utilization1` {Object} The result of a previous call to `eventLoopUtilization()` -* `utilization2` {Object} The result of a previous call to `eventLoopUtilization()` - prior to `util1` +* `utilization1` {Object} The result of a previous call to + `eventLoopUtilization()`. +* `utilization2` {Object} The result of a previous call to + `eventLoopUtilization()` prior to `utilization1`. * Returns {Object} * `idle` {number} * `active` {number} @@ -70,9 +71,9 @@ The `eventLoopUtilization()` method returns an object that contains the cumulative duration of time the event loop has been both idle and active as a high resolution milliseconds timer. The `utilization` value is the calculated Event Loop Utilization (ELU). If bootstrapping has not yet finished, the -properties have the value of 0. +properties have the value of `0`. -`utilization1` and `utilization2` are optional parameters. +Both `utilization1` and `utilization2` are optional parameters. If `utilization1` is passed, then the delta between the current call's `active` and `idle` times, as well as the corresponding `utilization` value are @@ -102,8 +103,8 @@ setImmediate(() => { ``` Although the CPU is mostly idle while running this script, the value of -`utilization` is 1. This is because the call to [`child_process.spawnSync()`][] -blocks the event loop from proceeding. +`utilization` is `1`. This is because the call to +[`child_process.spawnSync()`][] blocks the event loop from proceeding. Passing in a user-defined object instead of the result of a previous call to `eventLoopUtilization()` will lead to undefined behavior. The return values |