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

Unified Diff: runtime/bin/utils_macos.cc

Issue 25909002: Sampling profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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
Index: runtime/bin/utils_macos.cc
diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc
index c47feddf830425eec9c97a6cbbe5720b65bd5ce1..209bce19ee5fadcfecd37babf3eac53c86bd9257 100644
--- a/runtime/bin/utils_macos.cc
+++ b/runtime/bin/utils_macos.cc
@@ -98,7 +98,16 @@ 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;
siva 2013/10/28 05:19:21 Ditto.
Cutch 2013/11/04 20:36:05 Done.
+ start = now;
+ micros -= delta;
+ }
}
} // namespace bin

Powered by Google App Engine
This is Rietveld 408576698