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/tile.h" | 7 #include "cc/resources/tile.h" |
8 #include "cc/resources/tile_priority.h" | 8 #include "cc/resources/tile_priority.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 } | 168 } |
169 | 169 |
170 void CreateHighLowResAndSetAllTilesVisible() { | 170 void CreateHighLowResAndSetAllTilesVisible() { |
171 // Active layer must get updated first so pending layer can share from it. | 171 // Active layer must get updated first so pending layer can share from it. |
172 active_root_layer_->CreateDefaultTilingsAndTiles(); | 172 active_root_layer_->CreateDefaultTilingsAndTiles(); |
173 active_root_layer_->SetAllTilesVisible(); | 173 active_root_layer_->SetAllTilesVisible(); |
174 pending_root_layer_->CreateDefaultTilingsAndTiles(); | 174 pending_root_layer_->CreateDefaultTilingsAndTiles(); |
175 pending_root_layer_->SetAllTilesVisible(); | 175 pending_root_layer_->SetAllTilesVisible(); |
176 } | 176 } |
177 | 177 |
178 void RunRasterIteratorTest(const std::string& test_name, | 178 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
179 unsigned tile_count) { | 179 unsigned tile_count) { |
180 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
181 SMOOTHNESS_TAKES_PRIORITY, | |
182 NEW_CONTENT_TAKES_PRIORITY}; | |
183 int priority_count = 0; | |
180 timer_.Reset(); | 184 timer_.Reset(); |
181 do { | 185 do { |
182 int count = tile_count; | 186 int count = tile_count; |
183 RasterTilePriorityQueue queue; | 187 RasterTilePriorityQueue queue; |
184 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); | 188 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); |
185 while (count--) { | 189 while (count--) { |
186 ASSERT_FALSE(queue.IsEmpty()); | 190 ASSERT_FALSE(queue.IsEmpty()); |
187 ASSERT_TRUE(queue.Top() != NULL); | 191 ASSERT_TRUE(queue.Top() != NULL); |
188 queue.Pop(); | 192 queue.Pop(); |
189 } | 193 } |
194 priority_count = (priority_count + 1) % arraysize(priorities); | |
190 timer_.NextLap(); | 195 timer_.NextLap(); |
191 } while (!timer_.HasTimeLimitExpired()); | 196 } while (!timer_.HasTimeLimitExpired()); |
192 | 197 |
193 perf_test::PrintResult("tile_manager_raster_tile_iterator", | 198 perf_test::PrintResult( |
199 "tile_manager_raster_tile_queue_construct_and_iterate", | |
200 "", | |
201 test_name, | |
202 timer_.LapsPerSecond(), | |
203 "runs/s", | |
204 true); | |
205 } | |
206 | |
207 void RunRasterQueueConstructTest(const std::string& test_name) { | |
208 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
209 SMOOTHNESS_TAKES_PRIORITY, | |
210 NEW_CONTENT_TAKES_PRIORITY}; | |
211 int priority_count = 0; | |
212 timer_.Reset(); | |
213 do { | |
214 RasterTilePriorityQueue queue; | |
215 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | |
216 priority_count = (priority_count + 1) % arraysize(priorities); | |
217 timer_.NextLap(); | |
218 } while (!timer_.HasTimeLimitExpired()); | |
219 | |
220 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | |
194 "", | 221 "", |
195 test_name, | 222 test_name, |
196 timer_.LapsPerSecond(), | 223 timer_.LapsPerSecond(), |
197 "runs/s", | 224 "runs/s", |
198 true); | 225 true); |
199 } | 226 } |
200 | 227 |
201 std::vector<LayerImpl*> CreateLayers(int layer_count, | 228 std::vector<LayerImpl*> CreateLayers(int layer_count, |
202 int tiles_per_layer_count) { | 229 int tiles_per_layer_count) { |
203 // Compute the width/height required for high res to get | 230 // Compute the width/height required for high res to get |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 RunManageTilesTest("5_500", 5, 500); | 343 RunManageTilesTest("5_500", 5, 500); |
317 RunManageTilesTest("5_1000", 5, 1000); | 344 RunManageTilesTest("5_1000", 5, 1000); |
318 RunManageTilesTest("10_100", 10, 100); | 345 RunManageTilesTest("10_100", 10, 100); |
319 RunManageTilesTest("10_500", 10, 500); | 346 RunManageTilesTest("10_500", 10, 500); |
320 RunManageTilesTest("10_1000", 10, 1000); | 347 RunManageTilesTest("10_1000", 10, 1000); |
321 RunManageTilesTest("100_100", 100, 100); | 348 RunManageTilesTest("100_100", 100, 100); |
322 RunManageTilesTest("100_500", 100, 500); | 349 RunManageTilesTest("100_500", 100, 500); |
323 RunManageTilesTest("100_1000", 100, 1000); | 350 RunManageTilesTest("100_1000", 100, 1000); |
324 } | 351 } |
325 | 352 |
326 TEST_F(TileManagerPerfTest, RasterTileIterator) { | 353 TEST_F(TileManagerPerfTest, RasterTileQueueConstructAndIterate) { |
327 SetupDefaultTrees(gfx::Size(10000, 10000)); | 354 SetupDefaultTrees(gfx::Size(10000, 10000)); |
328 active_root_layer_->CreateDefaultTilingsAndTiles(); | 355 active_root_layer_->CreateDefaultTilingsAndTiles(); |
329 pending_root_layer_->CreateDefaultTilingsAndTiles(); | 356 pending_root_layer_->CreateDefaultTilingsAndTiles(); |
330 | 357 |
331 RunRasterIteratorTest("2_16", 16); | 358 RunRasterQueueConstructAndIterateTest("2_16", 16); |
332 RunRasterIteratorTest("2_32", 32); | 359 RunRasterQueueConstructAndIterateTest("2_32", 32); |
333 RunRasterIteratorTest("2_64", 64); | 360 RunRasterQueueConstructAndIterateTest("2_64", 64); |
334 RunRasterIteratorTest("2_128", 128); | 361 RunRasterQueueConstructAndIterateTest("2_128", 128); |
362 } | |
363 | |
364 TEST_F(TileManagerPerfTest, RasterTileQueueConstruct) { | |
reveman
2014/07/21 19:17:00
nit: not sure how you did this in other tests but
vmpstr
2014/07/21 19:29:27
Done.
| |
365 SetupDefaultTrees(gfx::Size(10000, 10000)); | |
366 active_root_layer_->CreateDefaultTilingsAndTiles(); | |
367 pending_root_layer_->CreateDefaultTilingsAndTiles(); | |
368 | |
369 RunRasterQueueConstructTest("2"); | |
370 | |
371 for (int i = 0; i < 8; ++i) { | |
372 PictureLayerTiling* tiling = active_root_layer_->AddTiling(i * 0.3f); | |
373 tiling->CreateAllTilesForTesting(); | |
374 } | |
375 | |
376 RunRasterQueueConstructTest("10"); | |
377 | |
378 for (int i = 0; i < 90; ++i) { | |
379 PictureLayerTiling* tiling = | |
380 active_root_layer_->AddTiling(1.0f + i * 0.03f); | |
381 tiling->CreateAllTilesForTesting(); | |
382 } | |
383 | |
384 RunRasterQueueConstructTest("100"); | |
335 } | 385 } |
336 | 386 |
337 } // namespace | 387 } // namespace |
338 | 388 |
339 } // namespace cc | 389 } // namespace cc |
OLD | NEW |