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

Commit 3671851

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 7fc9931 commit 3671851

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
@@ -1838,7 +1838,7 @@ added:
18381838
-->
18391839

18401840
An object that can be used to query performance information from a worker
1841-
instance. Similar to [`perf_hooks.performance`][].
1841+
instance.
18421842

18431843
#### `performance.eventLoopUtilization([utilization1[, utilization2]])`
18441844

@@ -2240,8 +2240,7 @@ thread spawned will spawn another until the application crashes.
22402240
[`fs.open()`]: fs.md#fsopenpath-flags-mode-callback
22412241
[`markAsUntransferable()`]: #worker_threadsmarkasuntransferableobject
22422242
[`node:cluster` module]: cluster.md
2243-
[`perf_hooks.performance`]: perf_hooks.md#perf_hooksperformance
2244-
[`perf_hooks` `eventLoopUtilization()`]: perf_hooks.md#performanceeventlooputilizationutilization1-utilization2
2243+
[`perf_hooks` `eventLoopUtilization()`]: perf_hooks.md#perf_hookseventlooputilizationutilization1-utilization2
22452244
[`port.on('message')`]: #event-message
22462245
[`port.onmessage()`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage
22472246
[`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)