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

Unified Diff: cc/resources/picture_layer_tiling_perftest.cc

Issue 392413002: cc: Add tiling eviction iterator perftests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling_perftest.cc
diff --git a/cc/resources/picture_layer_tiling_perftest.cc b/cc/resources/picture_layer_tiling_perftest.cc
index a610c1ea28e9a331aa9c9f0982362b0bf54dde61..d044d23eb2484a791d8f39c394d28f1f2a5ea3cd 100644
--- a/cc/resources/picture_layer_tiling_perftest.cc
+++ b/cc/resources/picture_layer_tiling_perftest.cc
@@ -141,6 +141,71 @@ class PictureLayerTilingPerfTest : public testing::Test {
true);
}
+ void RunTilingEvictionTileIteratorConstructionTest(
+ const std::string& test_name,
+ const gfx::Rect& viewport) {
+ gfx::Size bounds(viewport.size());
+ picture_layer_tiling_ =
+ PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
+ picture_layer_tiling_->UpdateTilePriorities(
+ ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
+
+ timer_.Reset();
+ const int num_tree_priorities = 3;
reveman 2014/07/16 20:17:05 nit: can you remove this and just do "priorities[]
vmpstr 2014/07/16 20:35:22 Done.
+ TreePriority priorities[num_tree_priorities] = {
+ SAME_PRIORITY_FOR_BOTH_TREES, SMOOTHNESS_TAKES_PRIORITY,
+ NEW_CONTENT_TAKES_PRIORITY};
+ int priority_count = 0;
+ do {
+ PictureLayerTiling::TilingEvictionTileIterator it(
+ picture_layer_tiling_.get(), priorities[priority_count]);
+ priority_count = (priority_count + 1) % num_tree_priorities;
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("tiling_eviction_tile_iterator_construction",
+ "",
+ test_name,
+ timer_.LapsPerSecond(),
+ "runs/s",
+ true);
+ }
+
+ void RunTilingEvictionTileIteratorTest(const std::string& test_name,
+ int num_tiles,
+ const gfx::Rect& viewport) {
+ gfx::Size bounds(10000, 10000);
+ picture_layer_tiling_ =
+ PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
+ picture_layer_tiling_->UpdateTilePriorities(
+ ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
+
+ timer_.Reset();
+ const int num_tree_priorities = 3;
reveman 2014/07/16 20:17:05 nit: remove and use arraysize?
vmpstr 2014/07/16 20:35:22 Done.
+ TreePriority priorities[num_tree_priorities] = {
+ SAME_PRIORITY_FOR_BOTH_TREES, SMOOTHNESS_TAKES_PRIORITY,
+ NEW_CONTENT_TAKES_PRIORITY};
+ int priority_count = 0;
+ do {
+ int count = num_tiles;
+ for (PictureLayerTiling::TilingEvictionTileIterator it(
+ picture_layer_tiling_.get(), priorities[priority_count]);
+ it && count;
reveman 2014/07/16 20:17:05 can you DHCECK(it) instead as the result would not
vmpstr 2014/07/16 20:35:22 That's the reason it needs resources. The iterator
reveman 2014/07/16 22:03:34 Can you set it to a fake resource? It seems better
vmpstr 2014/07/16 23:43:29 Done.
+ ++it) {
+ --count;
+ }
+ priority_count = (priority_count + 1) % num_tree_priorities;
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("tiling_eviction_tile_iterator",
+ "",
+ test_name,
+ timer_.LapsPerSecond(),
+ "runs/s",
+ true);
+ }
reveman 2014/07/16 20:17:05 It's a bit hard to evaluate this test when the res
vmpstr 2014/07/16 20:35:22 I've changed the name, since I think it's kind of
+
private:
FakePictureLayerTilingClient picture_layer_tiling_client_;
scoped_ptr<PictureLayerTiling> picture_layer_tiling_;
@@ -186,6 +251,28 @@ TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) {
RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500));
}
+TEST_F(PictureLayerTilingPerfTest, TilingEvictionTileIteratorConstruction) {
+ RunTilingEvictionTileIteratorConstructionTest("0_0_100x100",
+ gfx::Rect(0, 0, 100, 100));
+ RunTilingEvictionTileIteratorConstructionTest("50_0_100x100",
+ gfx::Rect(50, 0, 100, 100));
+ RunTilingEvictionTileIteratorConstructionTest("100_0_100x100",
+ gfx::Rect(100, 0, 100, 100));
+ RunTilingEvictionTileIteratorConstructionTest("150_0_100x100",
+ gfx::Rect(150, 0, 100, 100));
+}
+
+TEST_F(PictureLayerTilingPerfTest, TilingEvictionTileIterator) {
+ RunTilingEvictionTileIteratorTest(
+ "32_100x100", 32, gfx::Rect(0, 0, 100, 100));
+ RunTilingEvictionTileIteratorTest(
+ "32_500x500", 32, gfx::Rect(0, 0, 500, 500));
+ RunTilingEvictionTileIteratorTest(
+ "64_100x100", 64, gfx::Rect(0, 0, 100, 100));
+ RunTilingEvictionTileIteratorTest(
+ "64_500x500", 64, gfx::Rect(0, 0, 500, 500));
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698