-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.perf_hooksIssues and PRs related to the implementation of the Performance Timing API.Issues and PRs related to the implementation of the Performance Timing API.
Description
Affected URL(s)
https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2
Description of the problem
I saved the example code in a file test.mjs:
import { eventLoopUtilization } from 'node:perf_hooks';
import { spawnSync } from 'node:child_process';
setImmediate(() => {
const elu = eventLoopUtilization();
spawnSync('sleep', ['5']);
console.log(eventLoopUtilization(elu).utilization);
});Upon running node test.mjs, an exception is thrown:
SyntaxError: The requested module 'node:perf_hooks' does not provide an export named 'eventLoopUtilization'
However, importing performance works:
import { performance } from 'node:perf_hooks';
import { spawnSync } from 'node:child_process';
setImmediate(() => {
const elu = performance.eventLoopUtilization();
spawnSync('sleep', ['5']);
console.log(performance.eventLoopUtilization(elu).utilization);
});Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.perf_hooksIssues and PRs related to the implementation of the Performance Timing API.Issues and PRs related to the implementation of the Performance Timing API.