@@ -651,6 +651,22 @@ performance.mark('test');
651651performance .mark (' meow' );
652652```
653653
654+ ## ` perf_hooks.createHistogram([options]) `
655+ <!-- YAML
656+ added: REPLACEME
657+ -->
658+
659+ * ` options ` {Object}
660+ * ` min ` {number|bigint} The minimum recordable value. Must be an integer
661+ value greater than 0. ** Defaults** : ` 1 ` .
662+ * ` max ` {number|bigint} The maximum recordable value. Must be an integer
663+ value greater than ` min ` . ** Defaults** : ` Number.MAX_SAFE_INTEGER ` .
664+ * ` figures ` {number} The number of accuracy digits. Must be a number between
665+ ` 1 ` and ` 5 ` . ** Defaults** : ` 3 ` .
666+ * Returns {RecordableHistogram}
667+
668+ Returns a {RecordableHistogram}.
669+
654670## ` perf_hooks.monitorEventLoopDelay([options]) `
655671<!-- YAML
656672added: v11.10.0
@@ -659,12 +675,12 @@ added: v11.10.0
659675* ` options ` {Object}
660676 * ` resolution ` {number} The sampling rate in milliseconds. Must be greater
661677 than zero. ** Default:** ` 10 ` .
662- * Returns: {Histogram }
678+ * Returns: {IntervalHistogram }
663679
664680_ This property is an extension by Node.js. It is not available in Web browsers._
665681
666- Creates a ` Histogram ` object that samples and reports the event loop delay
667- over time. The delays will be reported in nanoseconds.
682+ Creates an ` IntervalHistogram ` object that samples and reports the event loop
683+ delay over time. The delays will be reported in nanoseconds.
668684
669685Using a timer to detect approximate event loop delay works because the
670686execution of timers is tied specifically to the lifecycle of the libuv
@@ -687,36 +703,12 @@ console.log(h.percentile(50));
687703console .log (h .percentile (99 ));
688704```
689705
690- ### Class: ` Histogram `
691- <!-- YAML
692- added: v11.10.0
693- -->
694- Tracks the event loop delay at a given sampling rate. The constructor of
695- this class not exposed to users.
696-
697- _ This property is an extension by Node.js. It is not available in Web browsers._
698-
699- #### ` histogram.disable() `
700- <!-- YAML
701- added: v11.10.0
702- -->
703-
704- * Returns: {boolean}
705-
706- Disables the event loop delay sample timer. Returns ` true ` if the timer was
707- stopped, ` false ` if it was already stopped.
708-
709- #### ` histogram.enable() `
706+ ## Class: ` Histogram `
710707<!-- YAML
711708added: v11.10.0
712709-->
713710
714- * Returns: {boolean}
715-
716- Enables the event loop delay sample timer. Returns ` true ` if the timer was
717- started, ` false ` if it was already started.
718-
719- #### ` histogram.exceeds `
711+ ### ` histogram.exceeds `
720712<!-- YAML
721713added: v11.10.0
722714-->
@@ -726,7 +718,7 @@ added: v11.10.0
726718The number of times the event loop delay exceeded the maximum 1 hour event
727719loop delay threshold.
728720
729- #### ` histogram.max `
721+ ### ` histogram.max `
730722<!-- YAML
731723added: v11.10.0
732724-->
@@ -735,7 +727,7 @@ added: v11.10.0
735727
736728The maximum recorded event loop delay.
737729
738- #### ` histogram.mean `
730+ ### ` histogram.mean `
739731<!-- YAML
740732added: v11.10.0
741733-->
@@ -744,7 +736,7 @@ added: v11.10.0
744736
745737The mean of the recorded event loop delays.
746738
747- #### ` histogram.min `
739+ ### ` histogram.min `
748740<!-- YAML
749741added: v11.10.0
750742-->
@@ -753,7 +745,7 @@ added: v11.10.0
753745
754746The minimum recorded event loop delay.
755747
756- #### ` histogram.percentile(percentile) `
748+ ### ` histogram.percentile(percentile) `
757749<!-- YAML
758750added: v11.10.0
759751-->
@@ -763,7 +755,7 @@ added: v11.10.0
763755
764756Returns the value at the given percentile.
765757
766- #### ` histogram.percentiles `
758+ ### ` histogram.percentiles `
767759<!-- YAML
768760added: v11.10.0
769761-->
@@ -772,14 +764,14 @@ added: v11.10.0
772764
773765Returns a ` Map ` object detailing the accumulated percentile distribution.
774766
775- #### ` histogram.reset() `
767+ ### ` histogram.reset() `
776768<!-- YAML
777769added: v11.10.0
778770-->
779771
780772Resets the collected histogram data.
781773
782- #### ` histogram.stddev `
774+ ### ` histogram.stddev `
783775<!-- YAML
784776added: v11.10.0
785777-->
@@ -788,6 +780,56 @@ added: v11.10.0
788780
789781The standard deviation of the recorded event loop delays.
790782
783+ ## Class: ` IntervalHistogram extends Histogram `
784+
785+ A ` Histogram ` that is periodically updated on a given interval.
786+
787+ ### ` histogram.disable() `
788+ <!-- YAML
789+ added: v11.10.0
790+ -->
791+
792+ * Returns: {boolean}
793+
794+ Disables the update interval timer. Returns ` true ` if the timer was
795+ stopped, ` false ` if it was already stopped.
796+
797+ ### ` histogram.enable() `
798+ <!-- YAML
799+ added: v11.10.0
800+ -->
801+
802+ * Returns: {boolean}
803+
804+ Enables the update interval timer. Returns ` true ` if the timer was
805+ started, ` false ` if it was already started.
806+
807+ ### Cloning an ` IntervalHistogram `
808+
809+ {IntervalHistogram} instances can be cloned via {MessagePort}. On the receiving
810+ end, the histogram is cloned as a plain {Histogram} object that does not
811+ implement the ` enable() ` and ` disable() ` methods.
812+
813+ ## Class: ` RecordableHistogram extends Histogram `
814+ <!-- YAML
815+ added: REPLACEME
816+ -->
817+
818+ ### ` histogram.record(val) `
819+ <!-- YAML
820+ added: REPLACEME
821+ -->
822+
823+ * ` val ` {number|bigint} The amount to record in the histogram.
824+
825+ ### ` histogram.recordDelta() `
826+ <!-- YAML
827+ added: REPLACEME
828+ -->
829+
830+ Calculates the amount of time (in nanoseconds) that has passed since the
831+ previous call to ` recordDelta() ` and records that amount in the histogram.
832+
791833## Examples
792834
793835### Measuring the duration of async operations
0 commit comments