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

Unified Diff: test/cctest/test-cpu-profiler.cc

Issue 10871039: Replacing circular queue by single buffer in CPU Profiler. (Closed) Base URL: http://git.chromium.org/external/v8.git@profiling
Patch Set: an attempt to fix a test that strangely crashed only once Created 8 years, 3 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
« src/cpu-profiler-inl.h ('K') | « src/platform-win32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« src/cpu-profiler-inl.h ('K') | « src/platform-win32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698