perf_hooks: move non-standard performance properties to perf_hooks · nodejs/node@1de0476 · GitHub
Skip to content

Commit 1de0476

Browse files
legendecasaduh95
authored andcommitted
perf_hooks: move non-standard performance properties to perf_hooks
`performance.eventLoopUtilization` and `performance.timerify` are not part of the Web API. Expose these two functions directly on the `perf_hooks` module. PR-URL: #60370 Fixes: #60368 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 84576ef commit 1de0476

6 files changed

Lines changed: 186 additions & 131 deletions

File tree

doc/api/perf_hooks.md

Lines changed: 155 additions & 110 deletions

doc/api/worker_threads.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ added:
18311831
-->
18321832

18331833
An object that can be used to query performance information from a worker
1834-
instance. Similar to [`perf_hooks.performance`][].
1834+
instance.
18351835

18361836
#### `performance.eventLoopUtilization([utilization1[, utilization2]])`
18371837

@@ -2227,8 +2227,7 @@ thread spawned will spawn another until the application crashes.
22272227
[`fs.open()`]: fs.md#fsopenpath-flags-mode-callback
22282228
[`markAsUntransferable()`]: #worker_threadsmarkasuntransferableobject
22292229
[`node:cluster` module]: cluster.md
2230-
[`perf_hooks.performance`]: perf_hooks.md#perf_hooksperformance
2231-
[`perf_hooks` `eventLoopUtilization()`]: perf_hooks.md#performanceeventlooputilizationutilization1-utilization2
2230+
[`perf_hooks` `eventLoopUtilization()`]: perf_hooks.md#perf_hookseventlooputilizationutilization1-utilization2
22322231
[`port.on('message')`]: #event-message
22332232
[`port.onmessage()`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage
22342233
[`port.postMessage()`]: #portpostmessagevalue-transferlist

lib/perf_hooks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const {
2828
} = require('internal/histogram');
2929

3030
const monitorEventLoopDelay = require('internal/perf/event_loop_delay');
31+
const { eventLoopUtilization } = require('internal/perf/event_loop_utilization');
32+
const timerify = require('internal/perf/timerify');
3133

3234
module.exports = {
3335
Performance,
@@ -38,6 +40,8 @@ module.exports = {
3840
PerformanceObserverEntryList,
3941
PerformanceResourceTiming,
4042
monitorEventLoopDelay,
43+
eventLoopUtilization,
44+
timerify,
4145
createHistogram,
4246
performance,
4347
};

test/parallel/test-performance-eventlooputil.js renamed to test/parallel/test-perf-hooks-eventlooputilization.js

Lines changed: 5 additions & 2 deletions

0 commit comments

Comments
 (0)