node/lib/perf_hooks.js
Chengzhong Wu 51a57f2b36
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: https://github.com/nodejs/node/pull/60370
Fixes: https://github.com/nodejs/node/issues/60368
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-28 00:23:50 +01:00

55 lines
1.2 KiB
JavaScript

'use strict';
const {
ObjectDefineProperty,
} = primordials;
const {
constants,
} = internalBinding('performance');
const { PerformanceEntry } = require('internal/perf/performance_entry');
const { PerformanceResourceTiming } = require('internal/perf/resource_timing');
const {
PerformanceObserver,
PerformanceObserverEntryList,
} = require('internal/perf/observe');
const {
PerformanceMark,
PerformanceMeasure,
} = require('internal/perf/usertiming');
const {
Performance,
performance,
} = require('internal/perf/performance');
const {
createHistogram,
} = require('internal/histogram');
const monitorEventLoopDelay = require('internal/perf/event_loop_delay');
const { eventLoopUtilization } = require('internal/perf/event_loop_utilization');
const timerify = require('internal/perf/timerify');
module.exports = {
Performance,
PerformanceEntry,
PerformanceMark,
PerformanceMeasure,
PerformanceObserver,
PerformanceObserverEntryList,
PerformanceResourceTiming,
monitorEventLoopDelay,
eventLoopUtilization,
timerify,
createHistogram,
performance,
};
ObjectDefineProperty(module.exports, 'constants', {
__proto__: null,
configurable: false,
enumerable: true,
value: constants,
});