Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: runtime/bin/utils_linux.cc

Issue 25909002: Sampling profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/utils_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/utils_linux.cc
diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc
index 66e6929371936be9c7595e94f094a8fab0acdc06..4506f6f2b27aab964ba1d62a685c8b25850dbb6f 100644
--- a/runtime/bin/utils_linux.cc
+++ b/runtime/bin/utils_linux.cc
@@ -96,7 +96,17 @@ int64_t TimerUtils::GetCurrentTimeMicros() {
}
void TimerUtils::Sleep(int64_t millis) {
- usleep(millis * 1000);
+ // We must loop here because SIGPROF will interrupt usleep.
+ int64_t micros = millis * 1000;
+ int64_t start = GetCurrentTimeMicros();
+ while (micros > 0) {
+ usleep(micros);
+ int64_t now = GetCurrentTimeMicros();
+ int64_t delta = now - start;
+ ASSERT(delta >= 0);
+ start = now;
+ micros -= delta;
+ }
}
} // namespace bin
« no previous file with comments | « no previous file | runtime/bin/utils_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698