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

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
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index de2afea156800d813254301cd5df6486242ec88a..57afdd3cc3de27a27d3398560fbe99cff3c4cb54 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,20 @@ IsolateProfilerData::~IsolateProfilerData() {
}
+void IsolateProfilerData::Block() {
+ block_count_++;
+}
+
+
+void IsolateProfilerData::Unblock() {
+ block_count_--;
Ivan Posva 2014/05/25 12:25:16 ASSERT that you are not over unblocking.
Cutch 2014/05/26 06:59:35 Added a FATAL.
+ 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_);

Powered by Google App Engine
This is Rietveld 408576698