+23
-1
lines changedFilter options
+23
-1
lines changed Original file line number Diff line number Diff line change
@@ -1973,6 +1973,23 @@ added: v11.10.0
1973
1973
Enables the update interval timer. Returns `true` if the timer was
1974
1974
started, `false` if it was already started.
1975
1975
1976
+
### `histogram[Symbol.dispose]()`
1977
+
1978
+
<!-- YAML
1979
+
added: REPLACEME
1980
+
-->
1981
+
1982
+
Disables the update interval timer when the histogram is disposed.
1983
+
1984
+
```js
1985
+
const { monitorEventLoopDelay } = require('node:perf_hooks');
1986
+
{
1987
+
using hist = monitorEventLoopDelay({ resolution: 20 });
1988
+
hist.enable();
1989
+
// The histogram will be disabled when the block is exited.
1990
+
}
1991
+
```
1992
+
1976
1993
### Cloning an `IntervalHistogram`
1977
1994
1978
1995
{IntervalHistogram} instances can be cloned via {MessagePort}. On the receiving
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ const {
3
3
ReflectConstruct,
4
4
SafeMap,
5
5
Symbol,
6
+
SymbolDispose,
6
7
} = primordials;
7
8
8
9
const {
@@ -38,7 +39,7 @@ const {
38
39
const kEnabled = Symbol('kEnabled');
39
40
40
41
class ELDHistogram extends Histogram {
41
-
constructor(i) {
42
+
constructor() {
42
43
throw new ERR_ILLEGAL_CONSTRUCTOR();
43
44
}
44
45
@@ -65,6 +66,10 @@ class ELDHistogram extends Histogram {
65
66
this[kHandle].stop();
66
67
return true;
67
68
}
69
+
70
+
[SymbolDispose]() {
71
+
this.disable();
72
+
}
68
73
}
69
74
70
75
/**
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4