Commit 15c0c3a8 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[profiler] use Sleep() on windows for long profile intervals.

See https://github.com/nodejs/diagnostics/issues/170

R=franzih@chromium.org

Change-Id: Iecc3bb27707b0d2afbb23fd9823d5cd4d725be6e
Reviewed-on: https://chromium-review.googlesource.com/931102Reviewed-by: 's avatarFranziska Hinkelmann <franzih@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51466}
parent d80e1f47
......@@ -165,9 +165,11 @@ void ProfilerEventsProcessor::Run() {
if (nextSampleTime > now) {
#if V8_OS_WIN
// Do not use Sleep on Windows as it is very imprecise.
// Could be up to 16ms jitter, which is unacceptable for the purpose.
while (base::TimeTicks::HighResolutionNow() < nextSampleTime) {
if (nextSampleTime - now < base::TimeDelta::FromMilliseconds(100)) {
// Do not use Sleep on Windows as it is very imprecise, with up to 16ms
// jitter, which is unacceptable for short profile intervals.
while (base::TimeTicks::HighResolutionNow() < nextSampleTime) {
}
}
#else
base::OS::Sleep(nextSampleTime - now);
......
Markdown is supported
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