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

Unified Diff: runtime/platform/thread_win.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/platform/thread_win.cc
diff --git a/runtime/platform/thread_win.cc b/runtime/platform/thread_win.cc
index e8be678cb6d0a1563aa38995f136ea9821cd4c91..72f22d7a407d9403bcaa1d0cc34b306c711f9ec4 100644
--- a/runtime/platform/thread_win.cc
+++ b/runtime/platform/thread_win.cc
@@ -92,6 +92,17 @@ intptr_t Thread::GetMaxStackSize() {
}
+ThreadId Thread::GetCurrentThreadId() {
+ return GetCurrentThread();
+}
+
+
+void Thread::GetThreadCPUUsage(int64_t* cpu_usage) {
+ ASSERT(cpu_usage != NULL);
+ *cpu_usage = 0;
siva 2013/10/28 05:19:21 UNIMPLEMENTED();
Cutch 2013/11/04 20:36:05 Done, but will be implemented soon.
+}
+
+
void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
ASSERT(key != kUnsetThreadLocalKey);
BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value));
@@ -338,6 +349,19 @@ Monitor::WaitResult Monitor::Wait(int64_t millis) {
}
+Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
+ // TODO(johnmccutchan): Investigate sub-millisecond sleep times on Windows.
+ int64_t millis = micros / kMicrosecondsPerMillisecond;
+ if ((millis * kMicrosecondsPerMillisecond) < micros) {
+ // We've been asked to sleep for a fraction of a millisecond,
+ // this isn't supported on Windows. Bumps milliseconds up by one
+ // so that we never return too early. We likely return late though.
+ millis += 1;
+ }
+ return Wait(millis);
+}
+
+
void Monitor::Notify() {
data_.SignalAndRemoveFirstWaiter();
}

Powered by Google App Engine
This is Rietveld 408576698