OLD | NEW |
---|---|
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 } while (!timer_.HasTimeLimitExpired()); | 134 } while (!timer_.HasTimeLimitExpired()); |
135 | 135 |
136 perf_test::PrintResult("tiling_raster_tile_iterator", | 136 perf_test::PrintResult("tiling_raster_tile_iterator", |
137 "", | 137 "", |
138 test_name, | 138 test_name, |
139 timer_.LapsPerSecond(), | 139 timer_.LapsPerSecond(), |
140 "runs/s", | 140 "runs/s", |
141 true); | 141 true); |
142 } | 142 } |
143 | 143 |
144 void RunTilingEvictionTileIteratorConstructionTest( | |
145 const std::string& test_name, | |
146 const gfx::Rect& viewport) { | |
147 gfx::Size bounds(viewport.size()); | |
148 picture_layer_tiling_ = | |
149 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | |
150 picture_layer_tiling_->UpdateTilePriorities( | |
151 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); | |
152 | |
153 timer_.Reset(); | |
154 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.
| |
155 TreePriority priorities[num_tree_priorities] = { | |
156 SAME_PRIORITY_FOR_BOTH_TREES, SMOOTHNESS_TAKES_PRIORITY, | |
157 NEW_CONTENT_TAKES_PRIORITY}; | |
158 int priority_count = 0; | |
159 do { | |
160 PictureLayerTiling::TilingEvictionTileIterator it( | |
161 picture_layer_tiling_.get(), priorities[priority_count]); | |
162 priority_count = (priority_count + 1) % num_tree_priorities; | |
163 timer_.NextLap(); | |
164 } while (!timer_.HasTimeLimitExpired()); | |
165 | |
166 perf_test::PrintResult("tiling_eviction_tile_iterator_construction", | |
167 "", | |
168 test_name, | |
169 timer_.LapsPerSecond(), | |
170 "runs/s", | |
171 true); | |
172 } | |
173 | |
174 void RunTilingEvictionTileIteratorTest(const std::string& test_name, | |
175 int num_tiles, | |
176 const gfx::Rect& viewport) { | |
177 gfx::Size bounds(10000, 10000); | |
178 picture_layer_tiling_ = | |
179 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | |
180 picture_layer_tiling_->UpdateTilePriorities( | |
181 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); | |
182 | |
183 timer_.Reset(); | |
184 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.
| |
185 TreePriority priorities[num_tree_priorities] = { | |
186 SAME_PRIORITY_FOR_BOTH_TREES, SMOOTHNESS_TAKES_PRIORITY, | |
187 NEW_CONTENT_TAKES_PRIORITY}; | |
188 int priority_count = 0; | |
189 do { | |
190 int count = num_tiles; | |
191 for (PictureLayerTiling::TilingEvictionTileIterator it( | |
192 picture_layer_tiling_.get(), priorities[priority_count]); | |
193 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.
| |
194 ++it) { | |
195 --count; | |
196 } | |
197 priority_count = (priority_count + 1) % num_tree_priorities; | |
198 timer_.NextLap(); | |
199 } while (!timer_.HasTimeLimitExpired()); | |
200 | |
201 perf_test::PrintResult("tiling_eviction_tile_iterator", | |
202 "", | |
203 test_name, | |
204 timer_.LapsPerSecond(), | |
205 "runs/s", | |
206 true); | |
207 } | |
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
| |
208 | |
144 private: | 209 private: |
145 FakePictureLayerTilingClient picture_layer_tiling_client_; | 210 FakePictureLayerTilingClient picture_layer_tiling_client_; |
146 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; | 211 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; |
147 | 212 |
148 LapTimer timer_; | 213 LapTimer timer_; |
149 }; | 214 }; |
150 | 215 |
151 TEST_F(PictureLayerTilingPerfTest, Invalidate) { | 216 TEST_F(PictureLayerTilingPerfTest, Invalidate) { |
152 Region one_tile(gfx::Rect(256, 256)); | 217 Region one_tile(gfx::Rect(256, 256)); |
153 RunInvalidateTest("1x1", one_tile); | 218 RunInvalidateTest("1x1", one_tile); |
(...skipping 25 matching lines...) Expand all Loading... | |
179 RunUpdateTilePrioritiesScrollingTest("perspective", transform); | 244 RunUpdateTilePrioritiesScrollingTest("perspective", transform); |
180 } | 245 } |
181 | 246 |
182 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { | 247 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { |
183 RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); | 248 RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); |
184 RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 249 RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
185 RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 250 RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
186 RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 251 RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
187 } | 252 } |
188 | 253 |
254 TEST_F(PictureLayerTilingPerfTest, TilingEvictionTileIteratorConstruction) { | |
255 RunTilingEvictionTileIteratorConstructionTest("0_0_100x100", | |
256 gfx::Rect(0, 0, 100, 100)); | |
257 RunTilingEvictionTileIteratorConstructionTest("50_0_100x100", | |
258 gfx::Rect(50, 0, 100, 100)); | |
259 RunTilingEvictionTileIteratorConstructionTest("100_0_100x100", | |
260 gfx::Rect(100, 0, 100, 100)); | |
261 RunTilingEvictionTileIteratorConstructionTest("150_0_100x100", | |
262 gfx::Rect(150, 0, 100, 100)); | |
263 } | |
264 | |
265 TEST_F(PictureLayerTilingPerfTest, TilingEvictionTileIterator) { | |
266 RunTilingEvictionTileIteratorTest( | |
267 "32_100x100", 32, gfx::Rect(0, 0, 100, 100)); | |
268 RunTilingEvictionTileIteratorTest( | |
269 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | |
270 RunTilingEvictionTileIteratorTest( | |
271 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | |
272 RunTilingEvictionTileIteratorTest( | |
273 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | |
274 } | |
275 | |
189 } // namespace | 276 } // namespace |
190 | 277 |
191 } // namespace cc | 278 } // namespace cc |
OLD | NEW |