Chromium Code Reviews| Index: src/cpu-profiler.h |
| diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h |
| index 2cef421f5175ab45e4f854802b8eb0fb4dc3edee..56934cc883e6d4f6654caf80756609e09561cfe0 100644 |
| --- a/src/cpu-profiler.h |
| +++ b/src/cpu-profiler.h |
| @@ -30,7 +30,6 @@ |
| #include "allocation.h" |
| #include "atomicops.h" |
| -#include "circular-queue.h" |
| #include "unbound-queue.h" |
| namespace v8 { |
| @@ -156,11 +155,11 @@ class ProfilerEventsProcessor : public Thread { |
| // Puts current stack into tick sample events buffer. |
| void AddCurrentStack(); |
| - // Tick sample events are filled directly in the buffer of the circular |
| - // queue (because the structure is of fixed width, but usually not all |
| - // stack frame entries are filled.) This method returns a pointer to the |
| - // next record of the buffer. |
| - INLINE(TickSample* TickSampleEvent()); |
| + // StartTickSampleEvent returns a pointer only if the ticks_buffer_ is empty, |
| + // FinishTickSampleEvent marks the ticks_buffer_ as filled. |
| + // Finish should be called only after successful Start (returning non-NULL pointer). |
|
Jakob Kummerow
2012/09/04 11:25:18
long line.
Also, can you put in an ASSERT that mak
|
| + INLINE(TickSample* StartTickSampleEvent()); |
| + INLINE(void FinishTickSampleEvent()) { ticks_buffer_is_empty_ = false; } |
| private: |
| union CodeEventsContainer { |
| @@ -172,7 +171,7 @@ class ProfilerEventsProcessor : public Thread { |
| // Called from events processing thread (Run() method.) |
| bool ProcessCodeEvent(unsigned* dequeue_order); |
| - bool ProcessTicks(int64_t stop_time, unsigned dequeue_order); |
| + bool ProcessTicks(unsigned dequeue_order); |
| void ProcessEventsQueue(int64_t stop_time, unsigned* dequeue_order); |
| INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); |
| @@ -183,7 +182,8 @@ class ProfilerEventsProcessor : public Thread { |
| // Sampling interval in microseconds. |
| const int interval_in_useconds_; |
| UnboundQueue<CodeEventsContainer> events_buffer_; |
| - SamplingCircularQueue ticks_buffer_; |
| + TickSampleEventRecord ticks_buffer_; |
| + bool ticks_buffer_is_empty_; |
| UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
| unsigned enqueue_order_; |
| }; |
| @@ -222,7 +222,9 @@ class CpuProfiler { |
| static bool HasDetachedProfiles(); |
| // Invoked from stack sampler (thread or signal handler.) |
| - static TickSample* TickSampleEvent(Isolate* isolate); |
| + // Finish should be called only after successful Start (returning non-NULL pointer). |
|
Jakob Kummerow
2012/09/04 11:25:18
long line
|
| + static TickSample* StartTickSampleEvent(Isolate* isolate); |
| + static void FinishTickSampleEvent(Isolate* isolate); |
| // Must be called via PROFILE macro, otherwise will crash when |
| // profiling is not enabled. |