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

Unified Diff: src/circular-queue.cc

Issue 12321046: Send SIGPROF signals on the profiler event processor thread (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fixed typo: Profler->Profiler Created 7 years, 10 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 | « src/circular-queue.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/circular-queue.cc
diff --git a/src/circular-queue.cc b/src/circular-queue.cc
index 928c3f0c05ecf8d09b3112cf6c7e5cbab0990bb8..2818ce927c23dbb792e9e89b85ec18d764f35c8d 100644
--- a/src/circular-queue.cc
+++ b/src/circular-queue.cc
@@ -33,18 +33,16 @@ namespace v8 {
namespace internal {
-SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes,
- int desired_chunk_size_in_bytes,
- int buffer_size_in_chunks)
+SamplingCircularQueue::SamplingCircularQueue(
+ int record_size_in_bytes,
+ int desired_chunk_size_in_bytes,
+ int buffer_size_in_chunks,
+ bool keep_producer_consumer_distance)
: record_size_(record_size_in_bytes / sizeof(Cell)),
chunk_size_in_bytes_(desired_chunk_size_in_bytes / record_size_in_bytes *
record_size_in_bytes),
chunk_size_(chunk_size_in_bytes_ / sizeof(Cell)),
buffer_size_(chunk_size_ * buffer_size_in_chunks),
- // The distance ensures that producer and consumer never step on
- // each other's chunks and helps eviction of produced data from
- // the CPU cache (having that chunk size is bigger than the cache.)
- producer_consumer_distance_(2 * chunk_size_),
buffer_(NewArray<Cell>(buffer_size_ + 1)) {
ASSERT(buffer_size_in_chunks > 2);
// Clean up the whole buffer to avoid encountering a random kEnd
@@ -74,7 +72,13 @@ SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes,
ASSERT(reinterpret_cast<byte*>(consumer_pos_ + 1) <=
positions_ + positions_size);
consumer_pos_->dequeue_chunk_pos = buffer_;
- consumer_pos_->dequeue_chunk_poll_pos = buffer_ + producer_consumer_distance_;
+ consumer_pos_->dequeue_chunk_poll_pos = buffer_;
+ // The distance ensures that producer and consumer never step on
+ // each other's chunks and helps eviction of produced data from
+ // the CPU cache (having that chunk size is bigger than the cache.)
+ if (keep_producer_consumer_distance) {
+ consumer_pos_->dequeue_chunk_poll_pos += 2 * chunk_size_;
+ }
consumer_pos_->dequeue_pos = NULL;
}
« no previous file with comments | « src/circular-queue.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698