Index: test/cctest/test-cpu-profiler.cc |
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc |
index 20af07054a6c2f4359533d2d4603c3764115ef4f..589e6d8c592476421e6897a382355d459653a3ff 100644 |
--- a/test/cctest/test-cpu-profiler.cc |
+++ b/test/cctest/test-cpu-profiler.cc |
@@ -5,6 +5,7 @@ |
#include "v8.h" |
#include "cpu-profiler-inl.h" |
#include "cctest.h" |
+#include "platform.h" |
#include "../include/v8-profiler.h" |
using i::CodeEntry; |
@@ -38,11 +39,13 @@ static inline i::Address ToAddress(int n) { |
return reinterpret_cast<i::Address>(n); |
} |
-static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, |
- i::Address frame1, |
- i::Address frame2 = NULL, |
- i::Address frame3 = NULL) { |
- i::TickSample* sample = proc->TickSampleEvent(); |
+static void AddTickSampleEvent(ProfilerEventsProcessor* processor, |
+ i::Address frame1, |
+ i::Address frame2 = NULL, |
+ i::Address frame3 = NULL) { |
+ i::TickSample* sample; |
+ i::OS::Sleep(20); |
+ while ((sample = processor->StartTickSampleEvent()) == NULL) i::OS::Sleep(20); |
sample->pc = frame1; |
sample->tos = frame1; |
sample->frames_count = 0; |
@@ -54,6 +57,7 @@ static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, |
sample->stack[1] = frame3; |
sample->frames_count = 2; |
} |
+ processor->FinishTickSampleEvent(); |
} |
namespace { |
@@ -108,8 +112,8 @@ TEST(CodeEvents) { |
processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500)); |
processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10); |
processor.CodeCreateEvent(i::Logger::STUB_TAG, 4, ToAddress(0x1605), 0x10); |
- // Enqueue a tick event to enable code events processing. |
- EnqueueTickSampleEvent(&processor, ToAddress(0x1000)); |
+ // Add a tick event to enable code events processing. |
+ AddTickSampleEvent(&processor, ToAddress(0x1000)); |
processor.Stop(); |
processor.Join(); |
@@ -154,12 +158,12 @@ TEST(TickEvents) { |
"ddd", |
ToAddress(0x1400), |
0x80); |
- EnqueueTickSampleEvent(&processor, ToAddress(0x1210)); |
- EnqueueTickSampleEvent(&processor, ToAddress(0x1305), ToAddress(0x1220)); |
- EnqueueTickSampleEvent(&processor, |
- ToAddress(0x1404), |
- ToAddress(0x1305), |
- ToAddress(0x1230)); |
+ AddTickSampleEvent(&processor, ToAddress(0x1210)); |
+ AddTickSampleEvent(&processor, ToAddress(0x1305), ToAddress(0x1220)); |
+ AddTickSampleEvent(&processor, |
+ ToAddress(0x1404), |
+ ToAddress(0x1305), |
+ ToAddress(0x1230)); |
processor.Stop(); |
processor.Join(); |
@@ -240,13 +244,14 @@ TEST(Issue1398) { |
ToAddress(0x1200), |
0x80); |
- i::TickSample* sample = processor.TickSampleEvent(); |
+ i::TickSample* sample = processor.StartTickSampleEvent(); |
sample->pc = ToAddress(0x1200); |
sample->tos = 0; |
sample->frames_count = i::TickSample::kMaxFramesCount; |
for (int i = 0; i < sample->frames_count; ++i) { |
sample->stack[i] = ToAddress(0x1200); |
} |
+ processor.FinishTickSampleEvent(); |
processor.Stop(); |
processor.Join(); |