Index: src/circular-queue.h |
diff --git a/src/circular-queue.h b/src/circular-queue.h |
index 73afc6831671c10c4f3c1bdccd8983c6e2ee8600..239ffe18d2e096abb24fe220b8b38478445fd2b5 100644 |
--- a/src/circular-queue.h |
+++ b/src/circular-queue.h |
@@ -45,8 +45,8 @@ namespace internal { |
class SamplingCircularQueue { |
public: |
// Executed on the application thread. |
- SamplingCircularQueue(int record_size_in_bytes, |
- int desired_chunk_size_in_bytes, |
+ SamplingCircularQueue(size_t record_size_in_bytes, |
+ size_t desired_chunk_size_in_bytes, |
int buffer_size_in_chunks); |
~SamplingCircularQueue(); |
@@ -67,12 +67,16 @@ class SamplingCircularQueue { |
void FlushResidualRecords(); |
typedef AtomicWord Cell; |
- // Reserved values for the first cell of a record. |
- static const Cell kClear = 0; // Marks clean (processed) chunks. |
- static const Cell kEnd = -1; // Marks the end of the buffer. |
private: |
+ // Reserved values for the chunk marker (first Cell in each chunk). |
+ enum { |
+ kClear, // Marks clean (processed) chunks. |
+ kEnqueueStarted // Marks chunks where enqueue started. |
+ }; |
+ |
struct ProducerPosition { |
+ Cell* next_chunk_pos; |
Cell* enqueue_pos; |
}; |
struct ConsumerPosition { |
@@ -85,10 +89,9 @@ class SamplingCircularQueue { |
INLINE(void WrapPositionIfNeeded(Cell** pos)); |
const int record_size_; |
- const int chunk_size_in_bytes_; |
+ const size_t chunk_size_in_bytes_; |
const int chunk_size_; |
const int buffer_size_; |
- const int producer_consumer_distance_; |
Cell* buffer_; |
byte* positions_; |
ProducerPosition* producer_pos_; |