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

Unified Diff: runtime/vm/profiler.cc

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.h ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index de2afea156800d813254301cd5df6486242ec88a..419c0ff05a6f936b8de5d2ba519785c7423be2d7 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -1585,6 +1585,7 @@ IsolateProfilerData::IsolateProfilerData(SampleBuffer* sample_buffer,
ASSERT(sample_buffer != NULL);
sample_buffer_ = sample_buffer;
own_sample_buffer_ = own_sample_buffer;
+ block_count_ = 0;
}
@@ -1597,6 +1598,23 @@ IsolateProfilerData::~IsolateProfilerData() {
}
+void IsolateProfilerData::Block() {
+ block_count_++;
+}
+
+
+void IsolateProfilerData::Unblock() {
+ block_count_--;
+ if (block_count_ < 0) {
+ FATAL("Too many calls to Dart_IsolateUnblocked.");
+ }
+ if (!blocked()) {
+ // We just unblocked this isolate, wake up the thread interrupter.
+ ThreadInterrupter::WakeUp();
+ }
+}
+
+
Sample* SampleBuffer::ReserveSample() {
ASSERT(samples_ != NULL);
uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_);
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698