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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 state.soft_memory_limit_in_bytes = | 385 state.soft_memory_limit_in_bytes = |
386 10000u * 4u * | 386 10000u * 4u * |
387 static_cast<size_t>(tile_size.width() * tile_size.height()); | 387 static_cast<size_t>(tile_size.width() * tile_size.height()); |
388 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | 388 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; |
389 state.num_resources_limit = 10000; | 389 state.num_resources_limit = 10000; |
390 state.memory_limit_policy = ALLOW_ANYTHING; | 390 state.memory_limit_policy = ALLOW_ANYTHING; |
391 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; | 391 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; |
392 return state; | 392 return state; |
393 } | 393 } |
394 | 394 |
395 void RunManageTilesTest(const std::string& test_name, | 395 void RunPrepareTilesTest(const std::string& test_name, |
396 int layer_count, | 396 int layer_count, |
397 int approximate_tile_count_per_layer) { | 397 int approximate_tile_count_per_layer) { |
398 std::vector<LayerImpl*> layers = | 398 std::vector<LayerImpl*> layers = |
399 CreateLayers(layer_count, approximate_tile_count_per_layer); | 399 CreateLayers(layer_count, approximate_tile_count_per_layer); |
400 timer_.Reset(); | 400 timer_.Reset(); |
401 bool resourceless_software_draw = false; | 401 bool resourceless_software_draw = false; |
402 do { | 402 do { |
403 BeginFrameArgs args = | 403 BeginFrameArgs args = |
404 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 404 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
405 host_impl_.UpdateCurrentBeginFrameArgs(args); | 405 host_impl_.UpdateCurrentBeginFrameArgs(args); |
406 for (unsigned i = 0; i < layers.size(); ++i) { | 406 for (unsigned i = 0; i < layers.size(); ++i) { |
407 layers[i]->UpdateTiles(Occlusion(), resourceless_software_draw); | 407 layers[i]->UpdateTiles(Occlusion(), resourceless_software_draw); |
408 } | 408 } |
409 | 409 |
410 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 410 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
411 tile_manager()->ManageTiles(global_state); | 411 tile_manager()->PrepareTiles(global_state); |
412 tile_manager()->UpdateVisibleTiles(); | 412 tile_manager()->UpdateVisibleTiles(); |
413 timer_.NextLap(); | 413 timer_.NextLap(); |
414 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); | 414 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); |
415 } while (!timer_.HasTimeLimitExpired()); | 415 } while (!timer_.HasTimeLimitExpired()); |
416 | 416 |
417 perf_test::PrintResult( | 417 perf_test::PrintResult("prepare_tiles", "", test_name, |
418 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 418 timer_.LapsPerSecond(), "runs/s", true); |
419 } | 419 } |
420 | 420 |
421 TileManager* tile_manager() { return host_impl_.tile_manager(); } | 421 TileManager* tile_manager() { return host_impl_.tile_manager(); } |
422 | 422 |
423 protected: | 423 protected: |
424 GlobalStateThatImpactsTilePriority global_state_; | 424 GlobalStateThatImpactsTilePriority global_state_; |
425 | 425 |
426 TestSharedBitmapManager shared_bitmap_manager_; | 426 TestSharedBitmapManager shared_bitmap_manager_; |
427 TileMemoryLimitPolicy memory_limit_policy_; | 427 TileMemoryLimitPolicy memory_limit_policy_; |
428 int max_tiles_; | 428 int max_tiles_; |
429 int id_; | 429 int id_; |
430 FakeImplProxy proxy_; | 430 FakeImplProxy proxy_; |
431 FakeLayerTreeHostImpl host_impl_; | 431 FakeLayerTreeHostImpl host_impl_; |
432 FakePictureLayerImpl* pending_root_layer_; | 432 FakePictureLayerImpl* pending_root_layer_; |
433 FakePictureLayerImpl* active_root_layer_; | 433 FakePictureLayerImpl* active_root_layer_; |
434 LapTimer timer_; | 434 LapTimer timer_; |
435 LayerTreeSettings settings_; | 435 LayerTreeSettings settings_; |
436 | 436 |
437 static const gfx::Size kDefaultTileSize; | 437 static const gfx::Size kDefaultTileSize; |
438 }; | 438 }; |
439 | 439 |
440 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100); | 440 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100); |
441 | 441 |
442 TEST_F(TileManagerPerfTest, ManageTiles) { | 442 TEST_F(TileManagerPerfTest, PrepareTiles) { |
443 RunManageTilesTest("2_100", 2, 100); | 443 RunPrepareTilesTest("2_100", 2, 100); |
444 RunManageTilesTest("2_500", 2, 500); | 444 RunPrepareTilesTest("2_500", 2, 500); |
445 RunManageTilesTest("2_1000", 2, 1000); | 445 RunPrepareTilesTest("2_1000", 2, 1000); |
446 RunManageTilesTest("10_100", 10, 100); | 446 RunPrepareTilesTest("10_100", 10, 100); |
447 RunManageTilesTest("10_500", 10, 500); | 447 RunPrepareTilesTest("10_500", 10, 500); |
448 RunManageTilesTest("10_1000", 10, 1000); | 448 RunPrepareTilesTest("10_1000", 10, 1000); |
449 RunManageTilesTest("50_100", 100, 100); | 449 RunPrepareTilesTest("50_100", 100, 100); |
450 RunManageTilesTest("50_500", 100, 500); | 450 RunPrepareTilesTest("50_500", 100, 500); |
451 RunManageTilesTest("50_1000", 100, 1000); | 451 RunPrepareTilesTest("50_1000", 100, 1000); |
452 } | 452 } |
453 | 453 |
454 TEST_F(TileManagerPerfTest, RasterTileQueueConstruct) { | 454 TEST_F(TileManagerPerfTest, RasterTileQueueConstruct) { |
455 RunRasterQueueConstructTest("2", 2); | 455 RunRasterQueueConstructTest("2", 2); |
456 RunRasterQueueConstructTest("10", 10); | 456 RunRasterQueueConstructTest("10", 10); |
457 RunRasterQueueConstructTest("50", 50); | 457 RunRasterQueueConstructTest("50", 50); |
458 } | 458 } |
459 | 459 |
460 TEST_F(TileManagerPerfTest, RasterTileQueueConstructAndIterate) { | 460 TEST_F(TileManagerPerfTest, RasterTileQueueConstructAndIterate) { |
461 RunRasterQueueConstructAndIterateTest("2_16", 2, 16); | 461 RunRasterQueueConstructAndIterateTest("2_16", 2, 16); |
(...skipping 27 matching lines...) Expand all Loading... |
489 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 489 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
490 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 490 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
491 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 491 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
492 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 492 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
493 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 493 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
494 } | 494 } |
495 | 495 |
496 } // namespace | 496 } // namespace |
497 | 497 |
498 } // namespace cc | 498 } // namespace cc |
OLD | NEW |