Commit 16f1c908 authored by vmpstr@chromium.org's avatar vmpstr@chromium.org

cc: Add layer eviction iterator perftests.

This patch adds a construct and a construct and iterate tests for
layer level eviction iterators.

Initial runs:
[ RUN      ] PictureLayerImplPerfTest.LayerEvictionTileIteratorConstructAndIterate
*RESULT layer_eviction_tile_iterator_construct_and_iterate: 32_100x100= 47900.80859375 runs/s
*RESULT layer_eviction_tile_iterator_construct_and_iterate: 32_500x500= 50885.39453125 runs/s
*RESULT layer_eviction_tile_iterator_construct_and_iterate: 64_100x100= 49707.58984375 runs/s
*RESULT layer_eviction_tile_iterator_construct_and_iterate: 64_500x500= 49089.5078125 runs/s
[       OK ] PictureLayerImplPerfTest.LayerEvictionTileIteratorConstructAndIterate (8069 ms)
[ RUN      ] PictureLayerImplPerfTest.LayerEvictionTileIteratorConstruct
*RESULT layer_eviction_tile_iterator_construct: 0_0_100x100= 52248.0390625 runs/s
*RESULT layer_eviction_tile_iterator_construct: 5000_0_100x100= 28544.1015625 runs/s
*RESULT layer_eviction_tile_iterator_construct: 9999_0_100x100= 29921.828125 runs/s
[       OK ] PictureLayerImplPerfTest.LayerEvictionTileIteratorConstruct (6042 ms)


R=reveman

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283979 0039d316-1c4b-4281-b951-d872f2087c98
parent de0c7ed5
...@@ -23,6 +23,17 @@ static const int kTimeLimitMillis = 2000; ...@@ -23,6 +23,17 @@ static const int kTimeLimitMillis = 2000;
static const int kWarmupRuns = 5; static const int kWarmupRuns = 5;
static const int kTimeCheckInterval = 10; static const int kTimeCheckInterval = 10;
void AddTiling(float scale,
FakePictureLayerImpl* layer,
std::vector<Tile*>* all_tiles) {
PictureLayerTiling* tiling = layer->AddTiling(scale);
tiling->CreateAllTilesForTesting();
std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting();
std::copy(
tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles));
}
class PictureLayerImplPerfTest : public testing::Test { class PictureLayerImplPerfTest : public testing::Test {
public: public:
PictureLayerImplPerfTest() PictureLayerImplPerfTest()
...@@ -82,6 +93,65 @@ class PictureLayerImplPerfTest : public testing::Test { ...@@ -82,6 +93,65 @@ class PictureLayerImplPerfTest : public testing::Test {
true); true);
} }
void RunEvictionIteratorConstructAndIterateTest(
const std::string& test_name,
int num_tiles,
const gfx::Size& viewport_size) {
host_impl_.SetViewportSize(viewport_size);
host_impl_.pending_tree()->UpdateDrawProperties();
TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
SMOOTHNESS_TAKES_PRIORITY,
NEW_CONTENT_TAKES_PRIORITY};
int priority_count = 0;
timer_.Reset();
do {
int count = num_tiles;
PictureLayerImpl::LayerEvictionTileIterator it(
pending_layer_, priorities[priority_count]);
while (count--) {
ASSERT_TRUE(it) << "count: " << count;
ASSERT_TRUE(*it != NULL) << "count: " << count;
++it;
}
priority_count = (priority_count + 1) % arraysize(priorities);
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate",
"",
test_name,
timer_.LapsPerSecond(),
"runs/s",
true);
}
void RunEvictionIteratorConstructTest(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();
TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
SMOOTHNESS_TAKES_PRIORITY,
NEW_CONTENT_TAKES_PRIORITY};
int priority_count = 0;
timer_.Reset();
do {
PictureLayerImpl::LayerEvictionTileIterator it(
pending_layer_, priorities[priority_count]);
priority_count = (priority_count + 1) % arraysize(priorities);
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
perf_test::PrintResult("layer_eviction_tile_iterator_construct",
"",
test_name,
timer_.LapsPerSecond(),
"runs/s",
true);
}
protected: protected:
TestSharedBitmapManager shared_bitmap_manager_; TestSharedBitmapManager shared_bitmap_manager_;
FakeImplProxy proxy_; FakeImplProxy proxy_;
...@@ -110,5 +180,52 @@ TEST_F(PictureLayerImplPerfTest, LayerRasterTileIterator) { ...@@ -110,5 +180,52 @@ TEST_F(PictureLayerImplPerfTest, LayerRasterTileIterator) {
RunLayerRasterTileIteratorTest("64_500x500", 64, gfx::Size(500, 500)); RunLayerRasterTileIteratorTest("64_500x500", 64, gfx::Size(500, 500));
} }
TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstructAndIterate) {
SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
std::vector<Tile*> all_tiles;
AddTiling(low_res_factor, pending_layer_, &all_tiles);
AddTiling(0.3f, pending_layer_, &all_tiles);
AddTiling(0.7f, pending_layer_, &all_tiles);
AddTiling(1.0f, pending_layer_, &all_tiles);
AddTiling(2.0f, pending_layer_, &all_tiles);
ASSERT_TRUE(host_impl_.tile_manager() != NULL);
host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
RunEvictionIteratorConstructAndIterateTest(
"32_100x100", 32, gfx::Size(100, 100));
RunEvictionIteratorConstructAndIterateTest(
"32_500x500", 32, gfx::Size(500, 500));
RunEvictionIteratorConstructAndIterateTest(
"64_100x100", 64, gfx::Size(100, 100));
RunEvictionIteratorConstructAndIterateTest(
"64_500x500", 64, gfx::Size(500, 500));
}
TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstruct) {
SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
std::vector<Tile*> all_tiles;
AddTiling(low_res_factor, pending_layer_, &all_tiles);
AddTiling(0.3f, pending_layer_, &all_tiles);
AddTiling(0.7f, pending_layer_, &all_tiles);
AddTiling(1.0f, pending_layer_, &all_tiles);
AddTiling(2.0f, pending_layer_, &all_tiles);
ASSERT_TRUE(host_impl_.tile_manager() != NULL);
host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
RunEvictionIteratorConstructTest("5000_0_100x100",
gfx::Rect(5000, 0, 100, 100));
RunEvictionIteratorConstructTest("9999_0_100x100",
gfx::Rect(9999, 0, 100, 100));
}
} // namespace } // namespace
} // namespace cc } // namespace cc
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