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

Side by Side Diff: content/renderer/devtools/v8_sampling_profiler_browsertest.cc

Issue 1029823002: V8 Sampling Profiler: Support sampling on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "content/public/test/render_view_test.h" 8 #include "content/public/test/render_view_test.h"
9 #include "content/renderer/devtools/v8_sampling_profiler.h" 9 #include "content/renderer/devtools/v8_sampling_profiler.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 scoped_ptr<V8SamplingProfiler> sampling_profiler_; 114 scoped_ptr<V8SamplingProfiler> sampling_profiler_;
115 base::Lock lock_; 115 base::Lock lock_;
116 116
117 ListValue trace_parsed_; 117 ListValue trace_parsed_;
118 TraceResultBuffer trace_buffer_; 118 TraceResultBuffer trace_buffer_;
119 TraceResultBuffer::SimpleOutput json_output_; 119 TraceResultBuffer::SimpleOutput json_output_;
120 }; 120 };
121 121
122 // TODO(alph): Implement on Windows, Android and non-x86. 122 TEST_F(V8SamplingProfilerTest, V8SamplingEventFired) {
123 // The SamplingEventForTesting is fired when the framework collected at
124 // least one JitCodeAdded event and one sample event.
125
126 #if defined(OS_WIN)
127 #define MAYBE(x) DISABLED_##x
128 #else
129 #define MAYBE(x) x
130 #endif
131
132 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingEventFired)) {
133 sampling_profiler_->EnableSamplingEventForTesting(0, 0); 123 sampling_profiler_->EnableSamplingEventForTesting(0, 0);
134 TraceLog::GetInstance()->SetEnabled( 124 TraceLog::GetInstance()->SetEnabled(
135 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")), 125 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")),
136 TraceLog::RECORDING_MODE, TraceOptions()); 126 TraceLog::RECORDING_MODE, TraceOptions());
137 base::RunLoop().RunUntilIdle(); 127 base::RunLoop().RunUntilIdle();
138 sampling_profiler_->WaitSamplingEventForTesting(); 128 sampling_profiler_->WaitSamplingEventForTesting();
139 TraceLog::GetInstance()->SetDisabled(); 129 TraceLog::GetInstance()->SetDisabled();
140 } 130 }
141 131
142 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingJitCodeEventsCollected)) { 132 TEST_F(V8SamplingProfilerTest, V8SamplingJitCodeEventsCollected) {
143 CollectTrace(1, 0); 133 CollectTrace(1, 0);
144 int jit_code_added_events_count = CountEvents("JitCodeAdded"); 134 int jit_code_added_events_count = CountEvents("JitCodeAdded");
145 CHECK_LT(0, jit_code_added_events_count); 135 CHECK_LT(0, jit_code_added_events_count);
146 base::RunLoop().RunUntilIdle(); 136 base::RunLoop().RunUntilIdle();
147 } 137 }
148 138
149 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingSamplesCollected)) { 139 TEST_F(V8SamplingProfilerTest, V8SamplingSamplesCollected) {
150 CollectTrace(0, 1); 140 CollectTrace(0, 1);
151 int sample_events_count = CountEvents("V8Sample"); 141 int sample_events_count = CountEvents("V8Sample");
152 CHECK_LT(0, sample_events_count); 142 CHECK_LT(0, sample_events_count);
153 base::RunLoop().RunUntilIdle(); 143 base::RunLoop().RunUntilIdle();
154 } 144 }
155 145
156 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698