Performance
performance.eventLoopUtilization()
Reports event-loop active and idle time plus the utilization ratio. Pass an earlier sample to obtain a delta. This metric describes the event loop, not total CPU usage or request latency. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].
Formal Syntax & Structure
nodejs syntaxnodejs
performance.eventLoopUtilization([utilization1[, utilization2]])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| utilization1 | object | Previous or later snapshot. |
| utilization2 | object | Earlier snapshot when comparing two. |
Return Value
object
Idle, active and utilization.
Working Example
Example Snippetnodejs
import { performance } from 'node:perf_hooks';import { setImmediate as turn } from 'node:timers/promises';const start = performance.eventLoopUtilization();await turn();const d = performance.eventLoopUtilization(start);console.log(d.idle >= 0 && d.active >= 0 && d.utilization >= 0 && d.utilization <= 1);