Skip to content

Commit 27c6191

Browse files
jasnelltargos
authored andcommitted
perf_hooks: multiple fixes for Histogram
* The createHistogram(options) options weren't actually implemented * Add a new count property that tracks the number of samples * Adds BigInt options for relevant properties * Adds add(other) method for RecordableHistogram * Cleans up and expands tests * Eliminates unnecessary ELDHistogram native class * Improve/Simplify histogram transfer impl Signed-off-by: James M Snell <[email protected]> perf_hooks: simplify Histogram constructor options Signed-off-by: James M Snell <[email protected]> PR-URL: #41153 Reviewed-By: Matteo Collina <[email protected]>
1 parent 011c5f6 commit 27c6191

9 files changed

+807
-211
lines changed

doc/api/perf_hooks.md

+86-3
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,11 @@ added:
817817
-->
818818

819819
* `options` {Object}
820-
* `min` {number|bigint} The minimum recordable value. Must be an integer
820+
* `lowest` {number|bigint} The lowest discernible value. Must be an integer
821821
value greater than 0. **Default:** `1`.
822-
* `max` {number|bigint} The maximum recordable value. Must be an integer
823-
value greater than `min`. **Default:** `Number.MAX_SAFE_INTEGER`.
822+
* `highest` {number|bigint} The highest recordable value. Must be an integer
823+
value that is equal to or greater than two times `min`.
824+
**Default:** `Number.MAX_SAFE_INTEGER`.
824825
* `figures` {number} The number of accuracy digits. Must be a number between
825826
`1` and `5`. **Default:** `3`.
826827
* Returns {RecordableHistogram}
@@ -870,6 +871,26 @@ console.log(h.percentile(99));
870871
added: v11.10.0
871872
-->
872873

874+
### `histogram.count`
875+
876+
<!-- YAML
877+
added: REPLACEME
878+
-->
879+
880+
* {number}
881+
882+
The number of samples recorded by the histogram.
883+
884+
### `histogram.countBigInt`
885+
886+
<!-- YAML
887+
added: REPLACEME
888+
-->
889+
890+
* {bigint}
891+
892+
The number of samples recorded by the histogram.
893+
873894
### `histogram.exceeds`
874895

875896
<!-- YAML
@@ -881,6 +902,17 @@ added: v11.10.0
881902
The number of times the event loop delay exceeded the maximum 1 hour event
882903
loop delay threshold.
883904

905+
### `histogram.exceedsBigInt`
906+
907+
<!-- YAML
908+
added: REPLACEME
909+
-->
910+
911+
* {bigint}
912+
913+
The number of times the event loop delay exceeded the maximum 1 hour event
914+
loop delay threshold.
915+
884916
### `histogram.max`
885917

886918
<!-- YAML
@@ -891,6 +923,16 @@ added: v11.10.0
891923

892924
The maximum recorded event loop delay.
893925

926+
### `histogram.maxBigInt`
927+
928+
<!-- YAML
929+
added: REPLACEME
930+
-->
931+
932+
* {bigint}
933+
934+
The maximum recorded event loop delay.
935+
894936
### `histogram.mean`
895937

896938
<!-- YAML
@@ -911,6 +953,16 @@ added: v11.10.0
911953

912954
The minimum recorded event loop delay.
913955

956+
### `histogram.minBigInt`
957+
958+
<!-- YAML
959+
added: REPLACEME
960+
-->
961+
962+
* {bigint}
963+
964+
The minimum recorded event loop delay.
965+
914966
### `histogram.percentile(percentile)`
915967

916968
<!-- YAML
@@ -922,6 +974,17 @@ added: v11.10.0
922974

923975
Returns the value at the given percentile.
924976

977+
### `histogram.percentileBigInt(percentile)`
978+
979+
<!-- YAML
980+
added: REPLACEME
981+
-->
982+
983+
* `percentile` {number} A percentile value in the range (0, 100).
984+
* Returns: {bigint}
985+
986+
Returns the value at the given percentile.
987+
925988
### `histogram.percentiles`
926989

927990
<!-- YAML
@@ -932,6 +995,16 @@ added: v11.10.0
932995

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

998+
### `histogram.percentilesBigInt`
999+
1000+
<!-- YAML
1001+
added: REPLACEME
1002+
-->
1003+
1004+
* {Map}
1005+
1006+
Returns a `Map` object detailing the accumulated percentile distribution.
1007+
9351008
### `histogram.reset()`
9361009

9371010
<!-- YAML
@@ -990,6 +1063,16 @@ added:
9901063
- v14.18.0
9911064
-->
9921065

1066+
### `histogram.add(other)`
1067+
1068+
<!-- YAML
1069+
added: REPLACEME
1070+
-->
1071+
1072+
* `other` {RecordableHistogram}
1073+
1074+
Adds the values from `other` to this histogram.
1075+
9931076
### `histogram.record(val)`
9941077

9951078
<!-- YAML

0 commit comments

Comments
 (0)