Index: src/cpu-profiler.cc |
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc |
index 747542f73781d79efc5ec5d297af6d7b6c1020da..16968c9f579dd71c472463e35643d9318f9976ba 100644 |
--- a/src/cpu-profiler.cc |
+++ b/src/cpu-profiler.cc |
@@ -40,8 +40,7 @@ |
namespace v8 { |
namespace internal { |
-static const int kTickSamplesBufferChunkSize = 64 * KB; |
-static const int kTickSamplesBufferChunksCount = 16; |
+static const size_t kTickSampleBufferSize = 1 * MB; |
static const int kProfilerStackSize = 64 * KB; |
@@ -50,8 +49,7 @@ ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) |
generator_(generator), |
running_(true), |
ticks_buffer_(sizeof(TickSampleEventRecord), |
- kTickSamplesBufferChunkSize, |
- kTickSamplesBufferChunksCount), |
+ kTickSampleBufferSize / sizeof(TickSampleEventRecord)), |
last_code_event_id_(0), last_processed_code_event_id_(0) { |
} |
@@ -114,23 +112,16 @@ bool ProfilerEventsProcessor::ProcessTicks() { |
generator_->RecordTickSample(record.sample); |
} |
- const TickSampleEventRecord* rec = |
+ const TickSampleEventRecord* record = |
TickSampleEventRecord::cast(ticks_buffer_.StartDequeue()); |
- if (rec == NULL) return !ticks_from_vm_buffer_.IsEmpty(); |
+ if (record == NULL) return !ticks_from_vm_buffer_.IsEmpty(); |
// Make a local copy of tick sample record to ensure that it won't |
// be modified as we are processing it. This is possible as the |
// sampler writes w/o any sync to the queue, so if the processor |
// will get far behind, a record may be modified right under its |
// feet. |
Benedikt Meurer
2013/08/13 09:31:32
We do no longer make a local copy here, so this co
yurys
2013/08/13 14:10:29
Done.
|
- TickSampleEventRecord record = *rec; |
- if (record.order != last_processed_code_event_id_) return true; |
- |
- // A paranoid check to make sure that we don't get a memory overrun |
- // in case of frames_count having a wild value. |
- if (record.sample.frames_count < 0 |
- || record.sample.frames_count > TickSample::kMaxFramesCount) |
- record.sample.frames_count = 0; |
- generator_->RecordTickSample(record.sample); |
+ if (record->order != last_processed_code_event_id_) return true; |
+ generator_->RecordTickSample(record->sample); |
ticks_buffer_.FinishDequeue(); |
} |
} |
@@ -148,7 +139,6 @@ void ProfilerEventsProcessor::Run() { |
} |
// Process remaining tick events. |
- ticks_buffer_.FlushResidualRecords(); |
do { |
ProcessTicks(); |
} while (ProcessCodeEvent()); |
@@ -166,12 +156,6 @@ CpuProfile* CpuProfiler::GetProfile(int index) { |
} |
-TickSample* CpuProfiler::TickSampleEvent() { |
- if (is_profiling_) return processor_->TickSampleEvent(); |
- return NULL; |
-} |
- |
- |
void CpuProfiler::DeleteAllProfiles() { |
if (is_profiling_) StopProcessor(); |
ResetProfiles(); |