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

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

Issue 398073002: cc: Add tiling raster tile iterator construction perftest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 "cc/debug/lap_timer.h" 5 #include "cc/debug/lap_timer.h"
6 #include "cc/resources/picture_layer_tiling.h" 6 #include "cc/resources/picture_layer_tiling.h"
7 #include "cc/test/fake_picture_layer_tiling_client.h" 7 #include "cc/test/fake_picture_layer_tiling_client.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/perf/perf_test.h" 10 #include "testing/perf/perf_test.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } while (!timer_.HasTimeLimitExpired()); 105 } while (!timer_.HasTimeLimitExpired());
106 106
107 perf_test::PrintResult("update_tile_priorities_scrolling", 107 perf_test::PrintResult("update_tile_priorities_scrolling",
108 "", 108 "",
109 test_name, 109 test_name,
110 timer_.LapsPerSecond(), 110 timer_.LapsPerSecond(),
111 "runs/s", 111 "runs/s",
112 true); 112 true);
113 } 113 }
114 114
115 void RunTilingRasterTileIteratorTest(const std::string& test_name, 115 void RunRasterIteratorConstructTest(const std::string& test_name,
116 int num_tiles, 116 const gfx::Rect& viewport) {
117 const gfx::Rect& viewport) { 117 gfx::Size bounds(viewport.size());
118 picture_layer_tiling_ =
119 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
120 picture_layer_tiling_->UpdateTilePriorities(
121 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
122
123 timer_.Reset();
124 do {
125 PictureLayerTiling::TilingRasterTileIterator it(
126 picture_layer_tiling_.get(), ACTIVE_TREE);
127 timer_.NextLap();
128 } while (!timer_.HasTimeLimitExpired());
129
130 perf_test::PrintResult("tiling_raster_tile_iterator_construct",
131 "",
132 test_name,
133 timer_.LapsPerSecond(),
134 "runs/s",
135 true);
136 }
137
138 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name,
139 int num_tiles,
140 const gfx::Rect& viewport) {
118 gfx::Size bounds(10000, 10000); 141 gfx::Size bounds(10000, 10000);
119 picture_layer_tiling_ = 142 picture_layer_tiling_ =
120 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); 143 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_);
121 picture_layer_tiling_->UpdateTilePriorities( 144 picture_layer_tiling_->UpdateTilePriorities(
122 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); 145 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
123 146
124 timer_.Reset(); 147 timer_.Reset();
125 do { 148 do {
126 int count = num_tiles; 149 int count = num_tiles;
127 for (PictureLayerTiling::TilingRasterTileIterator it( 150 PictureLayerTiling::TilingRasterTileIterator it(
128 picture_layer_tiling_.get(), ACTIVE_TREE); 151 picture_layer_tiling_.get(), ACTIVE_TREE);
129 it && count; 152 while (count--) {
130 ++it) { 153 ASSERT_TRUE(it) << "count: " << count;
131 --count; 154 ASSERT_TRUE(*it != NULL) << "count: " << count;
155 ++it;
132 } 156 }
157 ASSERT_EQ(-1, count);
reveman 2014/07/17 16:39:26 don't think you need this. it would be pretty hard
vmpstr 2014/07/17 17:16:24 Hehe, I'm just being overzealous. Removed.
133 timer_.NextLap(); 158 timer_.NextLap();
134 } while (!timer_.HasTimeLimitExpired()); 159 } while (!timer_.HasTimeLimitExpired());
135 160
136 perf_test::PrintResult("tiling_raster_tile_iterator", 161 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate",
137 "", 162 "",
138 test_name, 163 test_name,
139 timer_.LapsPerSecond(), 164 timer_.LapsPerSecond(),
140 "runs/s", 165 "runs/s",
141 true); 166 true);
142 } 167 }
143 168
144 private: 169 private:
145 FakePictureLayerTilingClient picture_layer_tiling_client_; 170 FakePictureLayerTilingClient picture_layer_tiling_client_;
146 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; 171 scoped_ptr<PictureLayerTiling> picture_layer_tiling_;
(...skipping 25 matching lines...) Expand all
172 197
173 transform.Rotate(10); 198 transform.Rotate(10);
174 RunUpdateTilePrioritiesStationaryTest("rotation", transform); 199 RunUpdateTilePrioritiesStationaryTest("rotation", transform);
175 RunUpdateTilePrioritiesScrollingTest("rotation", transform); 200 RunUpdateTilePrioritiesScrollingTest("rotation", transform);
176 201
177 transform.ApplyPerspectiveDepth(10); 202 transform.ApplyPerspectiveDepth(10);
178 RunUpdateTilePrioritiesStationaryTest("perspective", transform); 203 RunUpdateTilePrioritiesStationaryTest("perspective", transform);
179 RunUpdateTilePrioritiesScrollingTest("perspective", transform); 204 RunUpdateTilePrioritiesScrollingTest("perspective", transform);
180 } 205 }
181 206
182 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { 207 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIteratorConstruct) {
183 RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); 208 RunRasterIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
184 RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); 209 RunRasterIteratorConstructTest("50_0_100x100", gfx::Rect(50, 0, 100, 100));
185 RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); 210 RunRasterIteratorConstructTest("100_0_100x100", gfx::Rect(100, 0, 100, 100));
186 RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); 211 RunRasterIteratorConstructTest("150_0_100x100", gfx::Rect(150, 0, 100, 100));
212 }
213
214 TEST_F(PictureLayerTilingPerfTest,
215 TilingRasterTileIteratorConstructAndIterate) {
216 RunRasterIteratorConstructAndIterateTest(
217 "32_100x100", 32, gfx::Rect(0, 0, 100, 100));
218 RunRasterIteratorConstructAndIterateTest(
219 "32_500x500", 32, gfx::Rect(0, 0, 500, 500));
220 RunRasterIteratorConstructAndIterateTest(
221 "64_100x100", 64, gfx::Rect(0, 0, 100, 100));
222 RunRasterIteratorConstructAndIterateTest(
223 "64_500x500", 64, gfx::Rect(0, 0, 500, 500));
187 } 224 }
188 225
189 } // namespace 226 } // namespace
190 227
191 } // namespace cc 228 } // namespace cc
OLDNEW
« 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