Commit 6ec23f84 authored by vmpstr@chromium.org's avatar vmpstr@chromium.org

cc: Add layer raster tile iterator construct perftest

This patch adds a layer level raster tile perftest to measure how
expensive is it to create a layer raster tile iterator.

Initial run:
[ RUN      ] PictureLayerImplPerfTest.LayerRasterTileIteratorConstructAndIterate
*RESULT layer_raster_tile_iterator_construct_and_iterate: 32_100x100= 389462.09375 runs/s
*RESULT layer_raster_tile_iterator_construct_and_iterate: 32_500x500= 392804.6875 runs/s
*RESULT layer_raster_tile_iterator_construct_and_iterate: 64_100x100= 230574.3125 runs/s
*RESULT layer_raster_tile_iterator_construct_and_iterate: 64_500x500= 230933.953125 runs/s
[       OK ] PictureLayerImplPerfTest.LayerRasterTileIteratorConstructAndIterate (8408 ms)
[ RUN      ] PictureLayerImplPerfTest.LayerRasterTileIteratorConstruct
*RESULT layer_raster_tile_iterator_construct: 0_0_100x100= 2187284 runs/s
*RESULT layer_raster_tile_iterator_construct: 5000_0_100x100= 1882842.125 runs/s
*RESULT layer_raster_tile_iterator_construct: 9999_0_100x100= 2171275 runs/s
[       OK ] PictureLayerImplPerfTest.LayerRasterTileIteratorConstruct (7619 ms)

NOTE TO PERF SHERIFFS
---------------------
This patch replaces layer_raster_tile_iterator test with
layer_raster_tile_iterator_construct_and_iterate test.

R=reveman

Review URL: https://codereview.chromium.org/400753002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284105 0039d316-1c4b-4281-b951-d872f2087c98
parent 2260e5bf
......@@ -68,7 +68,8 @@ class PictureLayerImplPerfTest : public testing::Test {
pending_layer_->DoPostCommitInitializationIfNeeded();
}
void RunLayerRasterTileIteratorTest(const std::string& test_name,
void RunRasterIteratorConstructAndIterateTest(
const std::string& test_name,
int num_tiles,
const gfx::Size& viewport_size) {
host_impl_.SetViewportSize(viewport_size);
......@@ -77,15 +78,36 @@ class PictureLayerImplPerfTest : public testing::Test {
timer_.Reset();
do {
int count = num_tiles;
for (PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false);
it && count;
++it) {
--count;
PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false);
while (count--) {
ASSERT_TRUE(it) << "count: " << count;
ASSERT_TRUE(*it != NULL) << "count: " << count;
++it;
}
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate",
"",
test_name,
timer_.LapsPerSecond(),
"runs/s",
true);
}
void RunRasterIteratorConstructTest(const std::string& test_name,
const gfx::Rect& viewport) {
host_impl_.SetViewportSize(viewport.size());
pending_layer_->SetScrollOffset(gfx::Vector2d(viewport.x(), viewport.y()));
host_impl_.pending_tree()->UpdateDrawProperties();
timer_.Reset();
do {
PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false);
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
perf_test::PrintResult("layer_raster_tile_iterator",
perf_test::PrintResult("layer_raster_tile_iterator_construct",
"",
test_name,
timer_.LapsPerSecond(),
......@@ -163,7 +185,28 @@ class PictureLayerImplPerfTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest);
};
TEST_F(PictureLayerImplPerfTest, LayerRasterTileIterator) {
TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstructAndIterate) {
SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
pending_layer_->AddTiling(low_res_factor);
pending_layer_->AddTiling(0.3f);
pending_layer_->AddTiling(0.7f);
pending_layer_->AddTiling(1.0f);
pending_layer_->AddTiling(2.0f);
RunRasterIteratorConstructAndIterateTest(
"32_100x100", 32, gfx::Size(100, 100));
RunRasterIteratorConstructAndIterateTest(
"32_500x500", 32, gfx::Size(500, 500));
RunRasterIteratorConstructAndIterateTest(
"64_100x100", 64, gfx::Size(100, 100));
RunRasterIteratorConstructAndIterateTest(
"64_500x500", 64, gfx::Size(500, 500));
}
TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstruct) {
SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
......@@ -174,10 +217,11 @@ TEST_F(PictureLayerImplPerfTest, LayerRasterTileIterator) {
pending_layer_->AddTiling(1.0f);
pending_layer_->AddTiling(2.0f);
RunLayerRasterTileIteratorTest("32_100x100", 32, gfx::Size(100, 100));
RunLayerRasterTileIteratorTest("32_500x500", 32, gfx::Size(500, 500));
RunLayerRasterTileIteratorTest("64_100x100", 64, gfx::Size(100, 100));
RunLayerRasterTileIteratorTest("64_500x500", 64, gfx::Size(500, 500));
RunRasterIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
RunRasterIteratorConstructTest("5000_0_100x100",
gfx::Rect(5000, 0, 100, 100));
RunRasterIteratorConstructTest("9999_0_100x100",
gfx::Rect(9999, 0, 100, 100));
}
TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstructAndIterate) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment