Skip to content

perf_hooks: implement performance.eventLoopUtilization() - #32618

Open
robobun wants to merge 9 commits into
mainfrom
farm/4b495614/worker-threads-elu
Open

perf_hooks: implement performance.eventLoopUtilization()#32618
robobun wants to merge 9 commits into
mainfrom
farm/4b495614/worker-threads-elu

worker ELU: report real values between terminate() and exit, like Node

1fb33b3
Select commit
Loading
Failed to load commit list.
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

See this annotation in the file changed.

@claude 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