diff --git a/lib/internal/perf/nodetiming.js b/lib/internal/perf/nodetiming.js index 11f877e5d81b44..2958a0e303fe2e 100644 --- a/lib/internal/perf/nodetiming.js +++ b/lib/internal/perf/nodetiming.js @@ -28,6 +28,7 @@ const { NODE_PERFORMANCE_MILESTONE_ENVIRONMENT, }, loopIdleTime, + uvMetricsInfo, } = internalBinding('performance'); class PerformanceNodeTiming { @@ -122,6 +123,13 @@ class PerformanceNodeTiming { configurable: true, get: loopIdleTime, }, + + uvMetricsInfo: { + __proto__: null, + enumerable: true, + configurable: true, + get: uvMetricsInfo, + } }); } diff --git a/lib/internal/perf/performance.js b/lib/internal/perf/performance.js index da150eb97fabda..374e85898b6be7 100644 --- a/lib/internal/perf/performance.js +++ b/lib/internal/perf/performance.js @@ -39,7 +39,6 @@ const { } = require('internal/perf/observe'); const { eventLoopUtilization } = require('internal/perf/event_loop_utilization'); -const { uvMetricsInfo } = require('internal/perf/uv_metrics'); const nodeTiming = require('internal/perf/nodetiming'); const timerify = require('internal/perf/timerify'); const { customInspectSymbol: kInspect, kEnumerableProperty, kEmptyObject } = require('internal/util'); @@ -158,7 +157,6 @@ class Performance extends EventTarget { nodeTiming: this.nodeTiming, timeOrigin: this.timeOrigin, eventLoopUtilization: this.eventLoopUtilization(), - uvMetrics: this.uvMetricsInfo(), }; } } @@ -193,14 +191,6 @@ ObjectDefineProperties(Performance.prototype, { writable: true, value: eventLoopUtilization, }, - uvMetricsInfo: { - __proto__: null, - configurable: true, - // Node.js specific extensions. - enumerable: false, - writable: true, - value: uvMetricsInfo, - }, nodeTiming: { __proto__: null, diff --git a/lib/internal/perf/uv_metrics.js b/lib/internal/perf/uv_metrics.js deleted file mode 100644 index c5f4056f4de7b1..00000000000000 --- a/lib/internal/perf/uv_metrics.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const binding = internalBinding('performance'); - -function uvMetricsInfo() { - return binding.uvMetricsInfo(); -} - -module.exports = { - uvMetricsInfo, -}; diff --git a/test/parallel/test-performance-uvmetricsinfo.js b/test/parallel/test-performance-nodetiming-uvmetricsinfo.js similarity index 90% rename from test/parallel/test-performance-uvmetricsinfo.js rename to test/parallel/test-performance-nodetiming-uvmetricsinfo.js index 1e63ca34a5ea75..bdab0925dbce4c 100644 --- a/test/parallel/test-performance-uvmetricsinfo.js +++ b/test/parallel/test-performance-nodetiming-uvmetricsinfo.js @@ -10,17 +10,17 @@ const assert = require('node:assert'); const fs = require('node:fs'); const { performance } = require('node:perf_hooks'); -const { uvMetricsInfo } = performance; +const { nodeTiming } = performance; function safeMetricsInfo(cb) { setImmediate(() => { - const info = uvMetricsInfo(); + const info = nodeTiming.uvMetricsInfo; cb(info); }); } { - const info = uvMetricsInfo(); + const info = nodeTiming.uvMetricsInfo; assert.strictEqual(info.loopCount, 0); assert.strictEqual(info.events, 0); // This is the only part of the test that we test events waiting @@ -33,7 +33,7 @@ function safeMetricsInfo(cb) { // The synchronous call should obviously not affect the uv metrics const fd = fs.openSync(filepath, 'r'); fs.readFileSync(fd); - const info = uvMetricsInfo(); + const info = nodeTiming.uvMetricsInfo; assert.strictEqual(info.loopCount, 0); assert.strictEqual(info.events, 0); assert.strictEqual(info.eventsWaiting, 0);