Skip to content

Commit 15c0c3a

Browse files
hashseedCommit Bot
authored andcommitted
[profiler] use Sleep() on windows for long profile intervals.
See nodejs/diagnostics#170 [email protected] Change-Id: Iecc3bb27707b0d2afbb23fd9823d5cd4d725be6e Reviewed-on: https://chromium-review.googlesource.com/931102 Reviewed-by: Franziska Hinkelmann <[email protected]> Commit-Queue: Yang Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#51466}
1 parent d80e1f4 commit 15c0c3a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/profiler/cpu-profiler.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ void ProfilerEventsProcessor::Run() {
165165

166166
if (nextSampleTime > now) {
167167
#if V8_OS_WIN
168-
// Do not use Sleep on Windows as it is very imprecise.
169-
// Could be up to 16ms jitter, which is unacceptable for the purpose.
170-
while (base::TimeTicks::HighResolutionNow() < nextSampleTime) {
168+
if (nextSampleTime - now < base::TimeDelta::FromMilliseconds(100)) {
169+
// Do not use Sleep on Windows as it is very imprecise, with up to 16ms
170+
// jitter, which is unacceptable for short profile intervals.
171+
while (base::TimeTicks::HighResolutionNow() < nextSampleTime) {
172+
}
171173
}
172174
#else
173175
base::OS::Sleep(nextSampleTime - now);

0 commit comments

Comments
 (0)