Skip to content

Commit edb66ea

Browse files
committed
remove unused options
1 parent f9e014c commit edb66ea

4 files changed

Lines changed: 7 additions & 63 deletions

File tree

doc/api/perf_hooks.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,18 +1701,12 @@ Passing in a user-defined object instead of the result of a previous call to
17011701
`eventLoopUtilization()` will lead to undefined behavior. The return values
17021702
are not guaranteed to reflect any correct state of the event loop.
17031703

1704-
## `perf_hooks.monitorEventLoopDelay([options])`
1704+
## `perf_hooks.monitorEventLoopDelay()`
17051705

17061706
<!-- YAML
17071707
added: v11.10.0
17081708
-->
17091709

1710-
* `options` {Object}
1711-
* `resolution` {number} Deprecated. Previously the sampling rate in
1712-
milliseconds; sampling is now driven directly by the libuv event loop via
1713-
`uv_prepare_t`/`uv_check_t` hooks, so this value is ignored. It is still
1714-
validated to preserve backward compatible error behavior. Must be greater
1715-
than zero. **Default:** `10`.
17161710
* Returns: {ELDHistogram}
17171711

17181712
_This property is an extension by Node.js. It is not available in Web browsers._
@@ -1728,7 +1722,7 @@ the application is idle.
17281722
```mjs
17291723
import { monitorEventLoopDelay } from 'node:perf_hooks';
17301724

1731-
const h = monitorEventLoopDelay({ resolution: 20 });
1725+
const h = monitorEventLoopDelay();
17321726
h.enable();
17331727
// Do something.
17341728
h.disable();
@@ -1743,7 +1737,7 @@ console.log(h.percentile(99));
17431737

17441738
```cjs
17451739
const { monitorEventLoopDelay } = require('node:perf_hooks');
1746-
const h = monitorEventLoopDelay({ resolution: 20 });
1740+
const h = monitorEventLoopDelay();
17471741
h.enable();
17481742
// Do something.
17491743
h.disable();
@@ -2038,7 +2032,7 @@ Disables event loop delay sampling when the histogram is disposed.
20382032
```js
20392033
const { monitorEventLoopDelay } = require('node:perf_hooks');
20402034
{
2041-
using hist = monitorEventLoopDelay({ resolution: 20 });
2035+
using hist = monitorEventLoopDelay();
20422036
hist.enable();
20432037
// The histogram will be disabled when the block is exited.
20442038
}

doc/type-map.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"Http2Session": "http2.html#class-http2session",
6060
"Http2Stream": "http2.html#class-http2stream",
6161
"Immediate": "timers.html#class-immediate",
62-
"IntervalHistogram": "perf_hooks.html#class-intervalhistogram-extends-histogram",
62+
"ELDHistogram": "perf_hooks.html#class-eldhistogram-extends-histogram",
6363
"LockManager": "worker_threads.html#class-lockmanager",
6464
"KeyAlgorithm": "webcrypto.html#class-keyalgorithm",
6565
"KeyObject": "crypto.html#class-keyobject",

lib/internal/perf/event_loop_delay.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,12 @@ const {
1717
createELDHistogram,
1818
} = internalBinding('performance');
1919

20-
const {
21-
validateInteger,
22-
validateObject,
23-
} = require('internal/validators');
24-
2520
const {
2621
Histogram,
2722
kHandle,
2823
kMap,
2924
} = require('internal/histogram');
3025

31-
const {
32-
kEmptyObject,
33-
} = require('internal/util');
34-
3526
const {
3627
markTransferMode,
3728
} = require('internal/worker/js_transferable');
@@ -73,18 +64,9 @@ class ELDHistogram extends Histogram {
7364
}
7465

7566
/**
76-
* @param {{
77-
* resolution : number
78-
* }} [options]
7967
* @returns {ELDHistogram}
8068
*/
81-
function monitorEventLoopDelay(options = kEmptyObject) {
82-
// TODO: remove this once backward compatibility is removed
83-
validateObject(options, 'options');
84-
85-
const { resolution = 10 } = options;
86-
validateInteger(resolution, 'options.resolution', 1);
87-
69+
function monitorEventLoopDelay() {
8870
return ReflectConstruct(
8971
function() {
9072
markTransferMode(this, true, false);

test/sequential/test-performance-eventloopdelay.js

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,9 @@ const { sleep } = require('internal/util');
1919
assert(!histogram.disable());
2020
}
2121

22-
{
23-
[null, 'a', 1, false, Infinity].forEach((i) => {
24-
assert.throws(
25-
() => monitorEventLoopDelay(i),
26-
{
27-
name: 'TypeError',
28-
code: 'ERR_INVALID_ARG_TYPE',
29-
}
30-
);
31-
});
32-
33-
[null, 'a', false, {}, []].forEach((i) => {
34-
assert.throws(
35-
() => monitorEventLoopDelay({ resolution: i }),
36-
{
37-
name: 'TypeError',
38-
code: 'ERR_INVALID_ARG_TYPE',
39-
}
40-
);
41-
});
42-
43-
[-1, 0, 2 ** 53, Infinity].forEach((i) => {
44-
assert.throws(
45-
() => monitorEventLoopDelay({ resolution: i }),
46-
{
47-
name: 'RangeError',
48-
code: 'ERR_OUT_OF_RANGE',
49-
}
50-
);
51-
});
52-
}
53-
5422
{
5523
const s390x = os.arch() === 's390x';
56-
const histogram = monitorEventLoopDelay({ resolution: 1 });
24+
const histogram = monitorEventLoopDelay();
5725
histogram.enable();
5826
let m = 5;
5927
if (s390x) {

0 commit comments

Comments
 (0)