OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/time/time.h" | 5 #include "base/time/time.h" |
6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.h" |
7 #include "cc/resources/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 NEW_CONTENT_TAKES_PRIORITY}; | 176 NEW_CONTENT_TAKES_PRIORITY}; |
177 int priority_count = 0; | 177 int priority_count = 0; |
178 | 178 |
179 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 179 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
180 bool resourceless_software_draw = false; | 180 bool resourceless_software_draw = false; |
181 for (const auto& layer : layers) | 181 for (const auto& layer : layers) |
182 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 182 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
183 | 183 |
184 timer_.Reset(); | 184 timer_.Reset(); |
185 do { | 185 do { |
186 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 186 global_state_.tree_priority = priorities[priority_count]; |
187 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); | 187 host_impl_.tile_manager()->SetGlobalStateForTesting(global_state_); |
| 188 scoped_ptr<RasterTilePriorityQueue> queue( |
| 189 host_impl_.tile_manager()->BuildRasterQueue( |
| 190 RasterTilePriorityQueue::Type::ALL)); |
188 priority_count = (priority_count + 1) % arraysize(priorities); | 191 priority_count = (priority_count + 1) % arraysize(priorities); |
189 timer_.NextLap(); | 192 timer_.NextLap(); |
190 } while (!timer_.HasTimeLimitExpired()); | 193 } while (!timer_.HasTimeLimitExpired()); |
191 | 194 |
192 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 195 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
193 "", | 196 "", |
194 test_name, | 197 test_name, |
195 timer_.LapsPerSecond(), | 198 timer_.LapsPerSecond(), |
196 "runs/s", | 199 "runs/s", |
197 true); | 200 true); |
198 } | 201 } |
199 | 202 |
200 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 203 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
201 int layer_count, | 204 int layer_count, |
202 int tile_count) { | 205 int tile_count) { |
203 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 206 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
204 SMOOTHNESS_TAKES_PRIORITY, | 207 SMOOTHNESS_TAKES_PRIORITY, |
205 NEW_CONTENT_TAKES_PRIORITY}; | 208 NEW_CONTENT_TAKES_PRIORITY}; |
206 | 209 |
207 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 210 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
208 bool resourceless_software_draw = false; | 211 bool resourceless_software_draw = false; |
209 for (const auto& layer : layers) | 212 for (const auto& layer : layers) |
210 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 213 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
211 | 214 |
212 int priority_count = 0; | 215 int priority_count = 0; |
213 timer_.Reset(); | 216 timer_.Reset(); |
214 do { | 217 do { |
215 int count = tile_count; | 218 int count = tile_count; |
216 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 219 global_state_.tree_priority = priorities[priority_count]; |
217 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); | 220 host_impl_.tile_manager()->SetGlobalStateForTesting(global_state_); |
| 221 scoped_ptr<RasterTilePriorityQueue> queue( |
| 222 host_impl_.tile_manager()->BuildRasterQueue( |
| 223 RasterTilePriorityQueue::Type::ALL)); |
218 while (count--) { | 224 while (count--) { |
219 ASSERT_FALSE(queue->IsEmpty()); | 225 ASSERT_FALSE(queue->IsEmpty()); |
220 ASSERT_TRUE(queue->Top() != NULL); | 226 ASSERT_TRUE(queue->Top() != NULL); |
221 queue->Pop(); | 227 queue->Pop(); |
222 } | 228 } |
223 priority_count = (priority_count + 1) % arraysize(priorities); | 229 priority_count = (priority_count + 1) % arraysize(priorities); |
224 timer_.NextLap(); | 230 timer_.NextLap(); |
225 } while (!timer_.HasTimeLimitExpired()); | 231 } while (!timer_.HasTimeLimitExpired()); |
226 | 232 |
227 perf_test::PrintResult( | 233 perf_test::PrintResult( |
(...skipping 17 matching lines...) Expand all Loading... |
245 for (const auto& layer : layers) { | 251 for (const auto& layer : layers) { |
246 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 252 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
247 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 253 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
248 tile_manager()->InitializeTilesWithResourcesForTesting( | 254 tile_manager()->InitializeTilesWithResourcesForTesting( |
249 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 255 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
250 } | 256 } |
251 } | 257 } |
252 | 258 |
253 timer_.Reset(); | 259 timer_.Reset(); |
254 do { | 260 do { |
| 261 global_state_.tree_priority = priorities[priority_count]; |
| 262 host_impl_.tile_manager()->SetGlobalStateForTesting(global_state_); |
255 scoped_ptr<EvictionTilePriorityQueue> queue( | 263 scoped_ptr<EvictionTilePriorityQueue> queue( |
256 host_impl_.BuildEvictionQueue(priorities[priority_count])); | 264 host_impl_.tile_manager()->BuildEvictionQueue()); |
257 priority_count = (priority_count + 1) % arraysize(priorities); | 265 priority_count = (priority_count + 1) % arraysize(priorities); |
258 timer_.NextLap(); | 266 timer_.NextLap(); |
259 } while (!timer_.HasTimeLimitExpired()); | 267 } while (!timer_.HasTimeLimitExpired()); |
260 | 268 |
261 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct", | 269 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct", |
262 "", | 270 "", |
263 test_name, | 271 test_name, |
264 timer_.LapsPerSecond(), | 272 timer_.LapsPerSecond(), |
265 "runs/s", | 273 "runs/s", |
266 true); | 274 true); |
(...skipping 14 matching lines...) Expand all Loading... |
281 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 289 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
282 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 290 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
283 tile_manager()->InitializeTilesWithResourcesForTesting( | 291 tile_manager()->InitializeTilesWithResourcesForTesting( |
284 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 292 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
285 } | 293 } |
286 } | 294 } |
287 | 295 |
288 timer_.Reset(); | 296 timer_.Reset(); |
289 do { | 297 do { |
290 int count = tile_count; | 298 int count = tile_count; |
| 299 global_state_.tree_priority = priorities[priority_count]; |
| 300 host_impl_.tile_manager()->SetGlobalStateForTesting(global_state_); |
291 scoped_ptr<EvictionTilePriorityQueue> queue( | 301 scoped_ptr<EvictionTilePriorityQueue> queue( |
292 host_impl_.BuildEvictionQueue(priorities[priority_count])); | 302 host_impl_.tile_manager()->BuildEvictionQueue()); |
293 while (count--) { | 303 while (count--) { |
294 ASSERT_FALSE(queue->IsEmpty()); | 304 ASSERT_FALSE(queue->IsEmpty()); |
295 ASSERT_TRUE(queue->Top() != NULL); | 305 ASSERT_TRUE(queue->Top() != NULL); |
296 queue->Pop(); | 306 queue->Pop(); |
297 } | 307 } |
298 priority_count = (priority_count + 1) % arraysize(priorities); | 308 priority_count = (priority_count + 1) % arraysize(priorities); |
299 timer_.NextLap(); | 309 timer_.NextLap(); |
300 } while (!timer_.HasTimeLimitExpired()); | 310 } while (!timer_.HasTimeLimitExpired()); |
301 | 311 |
302 perf_test::PrintResult( | 312 perf_test::PrintResult( |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 480 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
471 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 481 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
472 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 482 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
473 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 483 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
474 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 484 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
475 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 485 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
476 } | 486 } |
477 | 487 |
478 } // namespace | 488 } // namespace |
479 } // namespace cc | 489 } // namespace cc |
OLD | NEW |