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