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

Side by Side Diff: cc/resources/tile_manager_perftest.cc

Issue 410523002: cc: Add eviction tile queue construct (and iterate) perftests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « no previous file | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 perf_test::PrintResult( 219 perf_test::PrintResult(
220 "tile_manager_raster_tile_queue_construct_and_iterate", 220 "tile_manager_raster_tile_queue_construct_and_iterate",
221 "", 221 "",
222 test_name, 222 test_name,
223 timer_.LapsPerSecond(), 223 timer_.LapsPerSecond(),
224 "runs/s", 224 "runs/s",
225 true); 225 true);
226 } 226 }
227 227
228 void RunEvictionQueueConstructTest(const std::string& test_name) {
229 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
230 SMOOTHNESS_TAKES_PRIORITY,
231 NEW_CONTENT_TAKES_PRIORITY};
232 int priority_count = 0;
233 timer_.Reset();
234 do {
235 EvictionTilePriorityQueue queue;
236 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]);
237 priority_count = (priority_count + 1) % arraysize(priorities);
238 timer_.NextLap();
239 } while (!timer_.HasTimeLimitExpired());
240
241 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct",
242 "",
243 test_name,
244 timer_.LapsPerSecond(),
245 "runs/s",
246 true);
247 }
248
249 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name,
250 unsigned tile_count) {
251 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
252 SMOOTHNESS_TAKES_PRIORITY,
253 NEW_CONTENT_TAKES_PRIORITY};
254 int priority_count = 0;
255 timer_.Reset();
256 do {
257 int count = tile_count;
258 EvictionTilePriorityQueue queue;
259 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]);
260 while (count--) {
261 ASSERT_FALSE(queue.IsEmpty());
262 ASSERT_TRUE(queue.Top() != NULL);
263 queue.Pop();
264 }
265 priority_count = (priority_count + 1) % arraysize(priorities);
266 timer_.NextLap();
267 } while (!timer_.HasTimeLimitExpired());
268
269 perf_test::PrintResult(
270 "tile_manager_eviction_tile_queue_construct_and_iterate",
271 "",
272 test_name,
273 timer_.LapsPerSecond(),
274 "runs/s",
275 true);
276 }
277
228 std::vector<LayerImpl*> CreateLayers(int layer_count, 278 std::vector<LayerImpl*> CreateLayers(int layer_count,
229 int tiles_per_layer_count) { 279 int tiles_per_layer_count) {
230 // Compute the width/height required for high res to get 280 // Compute the width/height required for high res to get
231 // tiles_per_layer_count tiles. 281 // tiles_per_layer_count tiles.
232 float width = std::sqrt(static_cast<float>(tiles_per_layer_count)); 282 float width = std::sqrt(static_cast<float>(tiles_per_layer_count));
233 float height = tiles_per_layer_count / width; 283 float height = tiles_per_layer_count / width;
234 284
235 // Adjust the width and height to account for the fact that tiles 285 // Adjust the width and height to account for the fact that tiles
236 // are bigger than 1x1. Also, account for the fact that that we 286 // are bigger than 1x1. Also, account for the fact that that we
237 // will be creating one high res and one low res tiling. That is, 287 // will be creating one high res and one low res tiling. That is,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 SetupDefaultTrees(gfx::Size(10000, 10000)); 429 SetupDefaultTrees(gfx::Size(10000, 10000));
380 active_root_layer_->CreateDefaultTilingsAndTiles(); 430 active_root_layer_->CreateDefaultTilingsAndTiles();
381 pending_root_layer_->CreateDefaultTilingsAndTiles(); 431 pending_root_layer_->CreateDefaultTilingsAndTiles();
382 432
383 RunRasterQueueConstructAndIterateTest("2_16", 16); 433 RunRasterQueueConstructAndIterateTest("2_16", 16);
384 RunRasterQueueConstructAndIterateTest("2_32", 32); 434 RunRasterQueueConstructAndIterateTest("2_32", 32);
385 RunRasterQueueConstructAndIterateTest("2_64", 64); 435 RunRasterQueueConstructAndIterateTest("2_64", 64);
386 RunRasterQueueConstructAndIterateTest("2_128", 128); 436 RunRasterQueueConstructAndIterateTest("2_128", 128);
387 } 437 }
388 438
439 TEST_F(TileManagerPerfTest, EvictionTileQueueConstruct) {
440 SetupDefaultTrees(gfx::Size(1000, 1000));
441 active_root_layer_->CreateDefaultTilingsAndTiles();
442 for (size_t i = 0; i < active_root_layer_->GetTilings()->num_tilings(); ++i) {
443 tile_manager()->InitializeTilesWithResourcesForTesting(
444 active_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
445 }
446 pending_root_layer_->CreateDefaultTilingsAndTiles();
447 for (size_t i = 0; i < pending_root_layer_->GetTilings()->num_tilings();
448 ++i) {
449 tile_manager()->InitializeTilesWithResourcesForTesting(
450 pending_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
451 }
452
453 RunEvictionQueueConstructTest("2");
454
455 int number_of_tilings = 2;
456 for (; number_of_tilings < 10; ++number_of_tilings) {
457 PictureLayerTiling* tiling =
458 active_root_layer_->AddTiling(1.0f + number_of_tilings * 0.3f);
459 tiling->CreateAllTilesForTesting();
460 tile_manager()->InitializeTilesWithResourcesForTesting(
461 tiling->AllTilesForTesting());
462 }
463
464 RunEvictionQueueConstructTest("10");
465
466 for (; number_of_tilings < 50; ++number_of_tilings) {
467 PictureLayerTiling* tiling =
468 active_root_layer_->AddTiling(1.0f + number_of_tilings * 0.3f);
469 tiling->CreateAllTilesForTesting();
470 tile_manager()->InitializeTilesWithResourcesForTesting(
471 tiling->AllTilesForTesting());
472 }
473
474 RunEvictionQueueConstructTest("50");
475 }
476
477 TEST_F(TileManagerPerfTest, EvictionTileQueueConstructAndIterate) {
478 SetupDefaultTrees(gfx::Size(10000, 10000));
479 active_root_layer_->CreateDefaultTilingsAndTiles();
480 for (size_t i = 0; i < active_root_layer_->GetTilings()->num_tilings(); ++i) {
481 tile_manager()->InitializeTilesWithResourcesForTesting(
482 active_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
483 }
484 pending_root_layer_->CreateDefaultTilingsAndTiles();
485 for (size_t i = 0; i < pending_root_layer_->GetTilings()->num_tilings();
486 ++i) {
487 tile_manager()->InitializeTilesWithResourcesForTesting(
488 pending_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
489 }
490
491 RunEvictionQueueConstructAndIterateTest("2_16", 16);
492 RunEvictionQueueConstructAndIterateTest("2_32", 32);
493 RunEvictionQueueConstructAndIterateTest("2_64", 64);
494 RunEvictionQueueConstructAndIterateTest("2_128", 128);
495 }
496
389 } // namespace 497 } // namespace
390 498
391 } // namespace cc 499 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698