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

Unified Diff: runtime/vm/thread_interrupter.h

Issue 297183003: Reduce CPU usage when no isolates need to be profiled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_interrupter.h
diff --git a/runtime/vm/thread_interrupter.h b/runtime/vm/thread_interrupter.h
index 9ee100e33509e2e6fe44355a98ff55d86558e80f..aaa9da40631960516b15042206f64698fd90b66d 100644
--- a/runtime/vm/thread_interrupter.h
+++ b/runtime/vm/thread_interrupter.h
@@ -19,10 +19,9 @@ struct InterruptedThreadState {
uintptr_t fp;
};
-// When a thread is interrupted the thread specific interrupt
-// callback will be invoked at the interrupt period. Each callback is given an
-// InterruptedThreadState and the thread specific data pointer. When inside a
-// thread interrupt callback doing any of the following
+// When a thread is interrupted the thread specific interrupt callback will be
+// invoked. Each callback is given an InterruptedThreadState and the user data
+// pointer. When inside a thread interrupt callback doing any of the following
// is forbidden:
// * Accessing TLS.
// * Allocating memory.
@@ -48,6 +47,9 @@ class ThreadInterrupter : public AllStatic {
// Delay between interrupts.
static void SetInterruptPeriod(intptr_t period);
+ // Wake up the thread interrupter thread.
+ static void WakeUp();
+
// Register the currently running thread for interrupts. If the current thread
// is already registered, callback and data will be updated.
static InterruptableThreadState* Register(ThreadInterruptCallback callback,
@@ -72,8 +74,13 @@ class ThreadInterrupter : public AllStatic {
static ThreadId interrupter_thread_id_;
static Monitor* monitor_;
static intptr_t interrupt_period_;
+ static intptr_t current_wait_time_;
static ThreadLocalKey thread_state_key_;
+ static bool InDeepSleep() {
+ return current_wait_time_ == Monitor::kNoTimeout;
+ }
+
static InterruptableThreadState* _EnsureThreadStateCreated();
static void UpdateStateObject(ThreadInterruptCallback callback, void* data);
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698