Skip to content

Commit

Permalink
doc: update eventLoopUtilization documentation
Browse files Browse the repository at this point in the history
PR-URL: #35155
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax authored and ruyadorno committed Sep 17, 2020
1 parent 32d1731 commit aea3f77
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;
Expand Down

0 comments on commit aea3f77

Please sign in to comment.