Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix some nits in perf_hooks #26022

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,14 @@ Returns a list of `PerformanceEntry` objects in chronological order
with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`
is equal to `type`.

## monitorEventLoopDelay([options])
## perf_hooks.monitorEventLoopDelay([options])
<!-- YAML
added: REPLACEME
-->

* `options` {Object}
* `resolution` {number} The sampling rate in milliseconds. Must be greater
than zero. Defaults to `10`.
than zero. **Default:** `10`.
* Returns: {Histogram}

Creates a `Histogram` object that samples and reports the event loop delay
Expand All @@ -421,7 +421,7 @@ detect.
const { monitorEventLoopDelay } = require('perf_hooks');
const h = monitorEventLoopDelay({ resolution: 20 });
h.enable();
// Do something
// Do something.
h.disable();
console.log(h.min);
console.log(h.max);
Expand Down Expand Up @@ -459,21 +459,30 @@ Enables the event loop delay sample timer. Returns `true` if the timer was
started, `false` if it was already started.

#### histogram.exceeds
<!-- YAML
added: REPLACEME
-->

* Value: {number}
* {number}

The number of times the event loop delay exceeded the maximum 1 hour event
loop delay threshold.

#### histogram.max
<!-- YAML
added: REPLACEME
-->

* Value: {number}
* {number}

The maximum recorded event loop delay.

#### histogram.mean
<!-- YAML
added: REPLACEME
-->

* Value: {number}
* {number}

The mean of the recorded event loop delays.

Expand All @@ -482,19 +491,26 @@ The mean of the recorded event loop delays.
added: REPLACEME
-->

* Value: {number}
* {number}

The minimum recorded event loop delay.

#### histogram.percentile(percentile)
<!-- YAML
added: REPLACEME
-->

* `percentile` {number} A percentile value between 1 and 100.
* Returns: {number}

Returns the value at the given percentile.

#### histogram.percentiles
<!-- YAML
added: REPLACEME
-->

* Value: {Map}
* {Map}

Returns a `Map` object detailing the accumulated percentile distribution.

Expand All @@ -506,8 +522,11 @@ added: REPLACEME
Resets the collected histogram data.

#### histogram.stddev
<!-- YAML
added: REPLACEME
-->

* Value: {number}
* {number}

The standard deviation of the recorded event loop delays.

Expand Down
3 changes: 1 addition & 2 deletions tools/doc/type-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const customTypesMap = {
'fs.Stats': 'fs.html#fs_class_fs_stats',
'fs.WriteStream': 'fs.html#fs_class_fs_writestream',

'Histogram': 'perf_hooks.html#perf_hooks_class_histogram',

'http.Agent': 'http.html#http_class_http_agent',
'http.ClientRequest': 'http.html#http_class_http_clientrequest',
'http.IncomingMessage': 'http.html#http_class_http_incomingmessage',
Expand Down Expand Up @@ -107,6 +105,7 @@ const customTypesMap = {

'os.constants.dlopen': 'os.html#os_dlopen_constants',

'Histogram': 'perf_hooks.html#perf_hooks_class_histogram',
'PerformanceEntry': 'perf_hooks.html#perf_hooks_class_performanceentry',
'PerformanceNodeTiming':
'perf_hooks.html#perf_hooks_class_performancenodetiming_extends_performanceentry', // eslint-disable-line max-len
Expand Down