Skip to content

fix: Do not call uv_cpu_info() for the CPU usage measurement on Linux - #45

Merged
andreiborza merged 1 commit into
mainfrom
ab/cpu-usage-without-cpufreq
Dec 1, 2026
Merged

andreiborza merged 1 commit into
mainfrom
ab/cpu-usage-without-cpufreq

Conversation

@andreiborza

Copy link
Copy Markdown
Member

What

On Linux, the CPU usage measurement now reads the total CPU times from /proc/stat. It no longer calls uv_cpu_info().

Why

uv_cpu_info() also reads the frequency file of each CPU, and that read is slow on some hosts. On a host with many CPUs, each tick of the measurement blocked the event loop for more than a second.

Closes: getsentry/sentry-javascript#27003

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@andreiborza
andreiborza marked this pull request as ready for review December 1, 2026 13:35
@andreiborza
andreiborza merged commit b7fe08d into main Dec 1, 2026
123 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

profiling-node: CPU measurement calls uv_cpu_info() on the main thread every 100 ms and blocks the event loop for ~1.5 s on 128-core Linux hosts

2 participants