mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
doc: update eventLoopUtilization documentation
PR-URL: https://github.com/nodejs/node/pull/35155 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
571dff81d5
commit
6eb15ce8a3
1 file changed
+16
-16
+16
-16
@@ -53,13 +53,13 @@ added: v8.5.0
|
||||
If `name` is not provided, removes all `PerformanceMark` objects from the
|
||||
Performance Timeline. If `name` is provided, removes only the named mark.
|
||||
|
||||
### `performance.eventLoopUtilization([util1][,util2])`
|
||||
### `performance.eventLoopUtilization([utilization1[, utilization2]])`
|
||||
<!-- YAML
|
||||
added: v14.10.0
|
||||
-->
|
||||
|
||||
* `util1` {Object} The result of a previous call to `eventLoopUtilization()`
|
||||
* `util2` {Object} The result of a previous call to `eventLoopUtilization()`
|
||||
* `utilization1` {Object} The result of a previous call to `eventLoopUtilization()`
|
||||
* `utilization2` {Object} The result of a previous call to `eventLoopUtilization()`
|
||||
prior to `util1`
|
||||
* Returns {Object}
|
||||
* `idle` {number}
|
||||
@@ -72,23 +72,23 @@ 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.
|
||||
|
||||
`util1` and `util2` are optional parameters.
|
||||
`utilization1` and `utilization2` are optional parameters.
|
||||
|
||||
If `util1` is passed then the delta between the current call's `active` and
|
||||
`idle` times are calculated and returned (similar to [`process.hrtime()`][]).
|
||||
Likewise the adjusted `utilization` value is calculated.
|
||||
If `utilization1` is passed, then the delta between the current call's `active`
|
||||
and `idle` times, as well as the corresponding `utilization` value are
|
||||
calculated and returned (similar to [`process.hrtime()`][]).
|
||||
|
||||
If `util1` and `util2` are both passed then the calculation adjustments are
|
||||
done between the two arguments. This is a convenience option because unlike
|
||||
[`process.hrtime()`][] additional work is done to calculate the ELU.
|
||||
If `utilization1` and `utilization2` are both passed, then the delta is
|
||||
calculated between the two arguments. This is a convenience option because,
|
||||
unlike [`process.hrtime()`][], calculating the ELU is more complex than a
|
||||
single subtraction.
|
||||
|
||||
ELU is similar to CPU utilization except that it is calculated using high
|
||||
precision wall-clock time. It represents the percentage of time the event loop
|
||||
has spent outside the event loop's event provider (e.g. `epoll_wait`). No other
|
||||
CPU idle time is taken into consideration. The following is an example of how
|
||||
a mostly idle process will have a high ELU.
|
||||
ELU is similar to CPU utilization, except that it only measures event loop
|
||||
statistics and not CPU usage. It represents the percentage of time the event
|
||||
loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
|
||||
No other CPU idle time is taken into consideration. The following is an example
|
||||
of how a mostly idle process will have a high ELU.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
```js
|
||||
'use strict';
|
||||
const { eventLoopUtilization } = require('perf_hooks').performance;
|
||||
|
||||
Reference in new issue
Block a user