Index: src/sampler.h |
diff --git a/src/sampler.h b/src/sampler.h |
index 80ccc087cadff8c17a0c73b8ce913836a1fc89e3..cd65b12238fd9a493f1fab31212968e1edc0d79b 100644 |
--- a/src/sampler.h |
+++ b/src/sampler.h |
@@ -94,14 +94,25 @@ class Sampler { |
void Start(); |
void Stop(); |
- // Is the sampler used for profiling? |
- bool IsProfiling() const { return NoBarrier_Load(&profiling_) > 0; } |
+ // Whether the sampling thread should use this Sampler for CPU profiling? |
+ bool IsProfiling() const { |
+ return NoBarrier_Load(&profiling_) > 0 && |
+ !NoBarrier_Load(&has_processing_thread_); |
+ } |
void IncreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, 1); } |
void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } |
// Whether the sampler is running (that is, consumes resources). |
bool IsActive() const { return NoBarrier_Load(&active_); } |
+ // If true next sample must be initiated on the profiler event processor |
+ // thread right after latest sample is processed. |
+ static bool CanSampleOnProfilerEventsProcessorThread(); |
+ void DoSample(); |
+ void SetHasProcessingThread(bool value) { |
+ NoBarrier_Store(&has_processing_thread_, value); |
+ } |
+ |
// Used in tests to make sure that stack sampling is performed. |
unsigned js_and_external_sample_count() const { |
return js_and_external_sample_count_; |
@@ -125,6 +136,7 @@ class Sampler { |
Isolate* isolate_; |
const int interval_; |
Atomic32 profiling_; |
+ Atomic32 has_processing_thread_; |
Atomic32 active_; |
PlatformData* data_; // Platform specific data. |
bool is_counting_samples_; |