@@ -1704,6 +1704,10 @@ are not guaranteed to reflect any correct state of the event loop.
17041704
17051705<!-- YAML
17061706added: v11.10.0
1707+ changes:
1708+ - version: REPLACEME
1709+ pr-url: https://github.com/nodejs/node/pull/62935
1710+ description: Added the `samplePerIteration` option.
17071711-->
17081712
17091713* ` options ` {Object}
@@ -1712,18 +1716,20 @@ added: v11.10.0
17121716 * ` resolution ` {number} The sampling rate in milliseconds for interval-based
17131717 sampling. Must be greater than zero. This option is ignored when
17141718 ` samplePerIteration ` is ` true ` . ** Default:** ` 10 ` .
1715- * Returns: {IntervalHistogram}
1719+ * Returns: {IntervalHistogram|ELDHistogram }
17161720
17171721_ This property is an extension by Node.js. It is not available in Web browsers._
17181722
1719- Creates an ` IntervalHistogram ` object that samples and reports the event loop
1720- delay over time. The delays will be reported in nanoseconds.
1723+ Creates a histogram object that samples and reports the event loop delay over
1724+ time. The delays will be reported in nanoseconds.
17211725
17221726By default, the histogram is updated by a timer using the configured
17231727` resolution ` . When ` samplePerIteration ` is ` true ` , samples are taken once per
17241728event loop iteration using ` uv_prepare_t ` and ` uv_check_t ` hooks. In that mode,
17251729the histogram does not keep the loop alive or force additional iterations when
17261730the application is idle.
1731+ The two sampling modes produce significantly different results and should not
1732+ be compared directly.
17271733
17281734``` mjs
17291735import { monitorEventLoopDelay } from ' node:perf_hooks' ;
@@ -2002,7 +2008,7 @@ The standard deviation of the recorded event loop delays.
20022008
20032009## Class: ` IntervalHistogram extends Histogram `
20042010
2005- A ` Histogram ` that records event loop delay.
2011+ A ` Histogram ` that records event loop delay using interval-based sampling .
20062012
20072013### ` histogram.disable() `
20082014
@@ -2043,11 +2049,17 @@ const { monitorEventLoopDelay } = require('node:perf_hooks');
20432049}
20442050```
20452051
2046- ### Cloning an ` IntervalHistogram `
2052+ ### Cloning event loop delay histograms
2053+
2054+ {IntervalHistogram} and {ELDHistogram} instances can be cloned via
2055+ {MessagePort}. On the receiving end, the histogram is cloned as a plain
2056+ {Histogram} object that does not implement the ` enable() ` and ` disable() `
2057+ methods.
2058+
2059+ ## Class: ` ELDHistogram extends Histogram `
20472060
2048- {IntervalHistogram} instances can be cloned via {MessagePort}. On the receiving
2049- end, the histogram is cloned as a plain {Histogram} object that does not
2050- implement the ` enable() ` and ` disable() ` methods.
2061+ A ` Histogram ` that records event loop delay once per event loop iteration. It
2062+ provides the same API as {IntervalHistogram}.
20512063
20522064## Class: ` RecordableHistogram extends Histogram `
20532065
0 commit comments