perf_hooks: implement performance.eventLoopUtilization() - #32618
Open
robobun wants to merge 9 commits into
Open
Claude / Claude Code Review
completed
Jul 16, 2026 in 20m 25s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | packages/bun-usockets/src/loop.c:61-66 |
Cross-thread ELU idle can go backwards between samples (torn {idle_time_ns, idle_entry_ns} read) |
Annotations
Check warning on line 66 in packages/bun-usockets/src/loop.c
claude / Claude Code Review
Cross-thread ELU idle can go backwards between samples (torn {idle_time_ns, idle_entry_ns} read)
The lock-free reader can return a *lower* idle than a previous call: if sample A lands mid-wait (returns `T + (now_a − E)`) and sample B lands in the writer's gap between `idle_entry_ns←0` and `idle_time_ns+=delta` (returns `T`), then `worker.performance.eventLoopUtilization(prev)` reports negative `idle` and `utilization > 1`. The comment at epoll_kqueue.c:452-459 acknowledges "slightly-low idle … acceptable" for a *single* read but doesn't consider that the primary API is a diff against a prio
Loading