Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

v8: don't busy loop in cpu profiler thread #9439

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion deps/v8/src/cpu-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,18 @@ void ProfilerEventsProcessor::Run() {
timer.Start();
// Keep processing existing events until we need to do next sample.
do {
if (FoundSampleForNextCodeEvent == ProcessOneSample()) {
switch (ProcessOneSample()) {
case FoundSampleForNextCodeEvent:
// All ticks of the current last_processed_code_event_id_ are
// processed, proceed to the next code event.
ProcessCodeEvent();
break;
case NoSamplesInQueue:
base::Thread::YieldCPU();
break;
default:
// carry on processing samples
break;
}
} while (!timer.HasExpired(period_));

Expand Down