Commit 3ea3308e authored by yurys@chromium.org's avatar yurys@chromium.org

Revert r16548 due to cpu profiler test falkiness

The change made cctest/test-cpu-profiler/CollectCpuProfile and cctest/test-cpu-profiler/JsNative1JsNative2JsSample flaky.

BUG=v8:2871
TBR=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/23615011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16553 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d208d048
...@@ -104,45 +104,49 @@ bool ProfilerEventsProcessor::ProcessCodeEvent() { ...@@ -104,45 +104,49 @@ bool ProfilerEventsProcessor::ProcessCodeEvent() {
} }
bool ProfilerEventsProcessor::ProcessOneSample() { bool ProfilerEventsProcessor::ProcessTicks() {
if (!ticks_from_vm_buffer_.IsEmpty() while (true) {
while (!ticks_from_vm_buffer_.IsEmpty()
&& ticks_from_vm_buffer_.Peek()->order == && ticks_from_vm_buffer_.Peek()->order ==
last_processed_code_event_id_) { last_processed_code_event_id_) {
TickSampleEventRecord record; TickSampleEventRecord record;
ticks_from_vm_buffer_.Dequeue(&record); ticks_from_vm_buffer_.Dequeue(&record);
generator_->RecordTickSample(record.sample); generator_->RecordTickSample(record.sample);
return false;
} }
const TickSampleEventRecord* record = ticks_buffer_.Peek(); const TickSampleEventRecord* record = ticks_buffer_.Peek();
if (record == NULL) return true; if (record == NULL) return !ticks_from_vm_buffer_.IsEmpty();
if (record->order != last_processed_code_event_id_) return true; if (record->order != last_processed_code_event_id_) return true;
generator_->RecordTickSample(record->sample); generator_->RecordTickSample(record->sample);
ticks_buffer_.Remove(); ticks_buffer_.Remove();
return false; }
} }
void ProfilerEventsProcessor::Run() { void ProfilerEventsProcessor::ProcessEventsAndDoSample() {
while (running_) {
ElapsedTimer timer; ElapsedTimer timer;
timer.Start(); timer.Start();
// Keep processing existing events until we need to do next sample. // Keep processing existing events until we need to do next sample.
do { while (!timer.HasExpired(period_)) {
if (ProcessOneSample()) { if (ProcessTicks()) {
// All ticks of the current last_processed_code_event_id_ are // All ticks of the current dequeue_order are processed,
// processed, proceed to the next code event. // proceed to the next code event.
ProcessCodeEvent(); ProcessCodeEvent();
} }
} while (!timer.HasExpired(period_)); }
// Schedule next sample. sampler_ is NULL in tests. // Schedule next sample. sampler_ is NULL in tests.
if (sampler_) sampler_->DoSample(); if (sampler_) sampler_->DoSample();
}
void ProfilerEventsProcessor::Run() {
while (running_) {
ProcessEventsAndDoSample();
} }
// Process remaining tick events. // Process remaining tick events.
do { do {
while (!ProcessOneSample()) {} ProcessTicks();
} while (ProcessCodeEvent()); } while (ProcessCodeEvent());
} }
......
...@@ -161,7 +161,9 @@ class ProfilerEventsProcessor : public Thread { ...@@ -161,7 +161,9 @@ class ProfilerEventsProcessor : public Thread {
private: private:
// Called from events processing thread (Run() method.) // Called from events processing thread (Run() method.)
bool ProcessCodeEvent(); bool ProcessCodeEvent();
bool ProcessOneSample(); bool ProcessTicks();
void ProcessEventsAndDoSample();
ProfileGenerator* generator_; ProfileGenerator* generator_;
Sampler* sampler_; Sampler* sampler_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment