Commit 6ebd85e1 authored by Ben Noordhuis's avatar Ben Noordhuis Committed by Trevor Norris
Browse files

v8: don't busy loop in cpu profiler thread

Reduce the overhead of the CPU profiler by replacing sched_yield() with
nanosleep() in V8's tick event processor thread.  The former only yields
the CPU when there is another process scheduled on the same CPU.

Before this commit, the thread would effectively busy loop and consume
100% CPU time.  By forcing a one nanosecond sleep period rounded up to
the task scheduler's granularity (about 50 us on Linux), CPU usage for
the processor thread now hovers around 10-20% for a busy application.

PR-URL: https://github.com/joyent/node/pull/8789
Ref: https://github.com/strongloop/strong-agent/issues/3


Reviewed-by: default avatarTrevor Norris <trev.norris@gmail.com>
parent fe201969
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment