Commit 37030851 authored by pneubeck's avatar pneubeck Committed by Commit bot

Revert of Unflake V8 sampling profiler tests. (patchset #1 id:1 of...

Revert of Unflake V8 sampling profiler tests. (patchset #1 id:1 of https://codereview.chromium.org/1032633002/)

Reason for revert:
Broke compilation on Mac Builder:
https://build.chromium.org/p/chromium.mac/builders/Mac%20Builder/builds/19512/steps/compile/logs/stdio

when compiling content/renderer/devtools/v8_sampling_profiler_browsertest.cc

Original issue's description:
> Unflake V8 sampling profiler tests.
>
> BUG=406277
>
> Committed: https://crrev.com/d6493ce2a4ed6f346a31597ac27748a3429a1d95
> Cr-Commit-Position: refs/heads/master@{#321970}

TBR=yurys@chromium.org,alph@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=406277

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

Cr-Commit-Position: refs/heads/master@{#321975}
parent dad0c535
......@@ -117,16 +117,9 @@ class Sampler {
void DoSample(const v8::RegisterState& state);
void SetEventsToCollectForTest(int code_added_events, int sample_events) {
code_added_events_to_collect_for_test_ = code_added_events;
sample_events_to_collect_for_test_ = sample_events;
}
bool EventsCollectedForTest() const {
return base::subtle::NoBarrier_Load(&code_added_events_count_) >=
code_added_events_to_collect_for_test_ &&
base::subtle::NoBarrier_Load(&samples_count_) >=
sample_events_to_collect_for_test_;
return base::subtle::NoBarrier_Load(&code_added_events_count_) != 0 ||
base::subtle::NoBarrier_Load(&samples_count_) != 0;
}
private:
......@@ -149,8 +142,6 @@ class Sampler {
scoped_ptr<SamplingQueue> samples_data_;
base::subtle::Atomic32 code_added_events_count_;
base::subtle::Atomic32 samples_count_;
int code_added_events_to_collect_for_test_;
int sample_events_to_collect_for_test_;
static base::LazyInstance<base::ThreadLocalPointer<Sampler>>::Leaky
tls_instance_;
......@@ -164,9 +155,7 @@ Sampler::Sampler()
thread_handle_(Sampler::GetCurrentThreadHandle()),
isolate_(Isolate::GetCurrent()),
code_added_events_count_(0),
samples_count_(0),
code_added_events_to_collect_for_test_(0),
sample_events_to_collect_for_test_(0) {
samples_count_(0) {
DCHECK(isolate_);
DCHECK(!GetInstance());
tls_instance_.Pointer()->Set(this);
......@@ -224,6 +213,7 @@ void Sampler::DoSample(const v8::RegisterState& state) {
return;
record->Collect(isolate_, timestamp, state);
samples_data_->FinishEnqueue();
base::subtle::NoBarrier_AtomicIncrement(&samples_count_, 1);
}
void Sampler::InjectPendingEvents() {
......@@ -235,7 +225,6 @@ void Sampler::InjectPendingEvents() {
record->ToTraceFormat());
samples_data_->Remove();
record = samples_data_->Peek();
base::subtle::NoBarrier_AtomicIncrement(&samples_count_, 1);
}
}
......@@ -559,10 +548,7 @@ void V8SamplingProfiler::OnTraceLogDisabled() {
sampling_thread_.reset();
}
void V8SamplingProfiler::EnableSamplingEventForTesting(int code_added_events,
int sample_events) {
render_thread_sampler_->SetEventsToCollectForTest(code_added_events,
sample_events);
void V8SamplingProfiler::EnableSamplingEventForTesting() {
waitable_event_for_testing_.reset(new base::WaitableEvent(false, false));
}
......
......@@ -26,7 +26,7 @@ class CONTENT_EXPORT V8SamplingProfiler final
void OnTraceLogEnabled() override;
void OnTraceLogDisabled() override;
void EnableSamplingEventForTesting(int code_added_events, int sample_events);
void EnableSamplingEventForTesting();
void WaitSamplingEventForTesting();
private:
......
......@@ -77,10 +77,9 @@ class V8SamplingProfilerTest : public RenderViewTest {
flush_complete_event->Signal();
}
void CollectTrace(int code_added_events, int sample_events) {
void CollectTrace() {
TraceLog* trace_log = TraceLog::GetInstance();
sampling_profiler_->EnableSamplingEventForTesting(code_added_events,
sample_events);
sampling_profiler_->EnableSamplingEventForTesting();
trace_log->SetEnabled(
CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")),
TraceLog::RECORDING_MODE, TraceOptions());
......@@ -130,7 +129,7 @@ class V8SamplingProfilerTest : public RenderViewTest {
#endif
TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingEventFired)) {
sampling_profiler_->EnableSamplingEventForTesting(0, 0);
sampling_profiler_->EnableSamplingEventForTesting();
TraceLog::GetInstance()->SetEnabled(
CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")),
TraceLog::RECORDING_MODE, TraceOptions());
......@@ -140,14 +139,14 @@ TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingEventFired)) {
}
TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingJitCodeEventsCollected)) {
CollectTrace(1, 0);
CollectTrace();
int jit_code_added_events_count = CountEvents("JitCodeAdded");
CHECK_LT(0, jit_code_added_events_count);
base::RunLoop().RunUntilIdle();
}
TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingSamplesCollected)) {
CollectTrace(0, 1);
CollectTrace();
int sample_events_count = CountEvents("V8Sample");
CHECK_LT(0, sample_events_count);
base::RunLoop().RunUntilIdle();
......
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