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

Side by Side Diff: cc/layers/picture_layer_impl_perftest.cc

Issue 816163002: cc: Changed some perftest names that don't reflect functionality tested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include "cc/debug/lap_timer.h" 7 #include "cc/debug/lap_timer.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/fake_output_surface.h" 10 #include "cc/test/fake_output_surface.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 scoped_ptr<TilingSetRasterQueue> queue = 78 scoped_ptr<TilingSetRasterQueue> queue =
79 pending_layer_->CreateRasterQueue(false); 79 pending_layer_->CreateRasterQueue(false);
80 while (count--) { 80 while (count--) {
81 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; 81 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
82 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; 82 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
83 queue->Pop(); 83 queue->Pop();
84 } 84 }
85 timer_.NextLap(); 85 timer_.NextLap();
86 } while (!timer_.HasTimeLimitExpired()); 86 } while (!timer_.HasTimeLimitExpired());
87 87
88 perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate", 88 perf_test::PrintResult("tiling_set_raster_queue_construct_and_iterate", "",
89 "", 89 test_name, timer_.LapsPerSecond(), "runs/s", true);
90 test_name,
91 timer_.LapsPerSecond(),
92 "runs/s",
93 true);
94 } 90 }
95 91
96 void RunRasterQueueConstructTest(const std::string& test_name, 92 void RunRasterQueueConstructTest(const std::string& test_name,
97 const gfx::Rect& viewport) { 93 const gfx::Rect& viewport) {
98 host_impl_.SetViewportSize(viewport.size()); 94 host_impl_.SetViewportSize(viewport.size());
99 pending_layer_->SetScrollOffset( 95 pending_layer_->SetScrollOffset(
100 gfx::ScrollOffset(viewport.x(), viewport.y())); 96 gfx::ScrollOffset(viewport.x(), viewport.y()));
101 host_impl_.pending_tree()->UpdateDrawProperties(); 97 host_impl_.pending_tree()->UpdateDrawProperties();
102 98
103 timer_.Reset(); 99 timer_.Reset();
104 do { 100 do {
105 scoped_ptr<TilingSetRasterQueue> queue = 101 scoped_ptr<TilingSetRasterQueue> queue =
106 pending_layer_->CreateRasterQueue(false); 102 pending_layer_->CreateRasterQueue(false);
107 timer_.NextLap(); 103 timer_.NextLap();
108 } while (!timer_.HasTimeLimitExpired()); 104 } while (!timer_.HasTimeLimitExpired());
109 105
110 perf_test::PrintResult("layer_raster_tile_iterator_construct", 106 perf_test::PrintResult("tiling_set_raster_queue_construct", "", test_name,
111 "", 107 timer_.LapsPerSecond(), "runs/s", true);
112 test_name,
113 timer_.LapsPerSecond(),
114 "runs/s",
115 true);
116 } 108 }
117 109
118 void RunEvictionQueueConstructAndIterateTest( 110 void RunEvictionQueueConstructAndIterateTest(
119 const std::string& test_name, 111 const std::string& test_name,
120 int num_tiles, 112 int num_tiles,
121 const gfx::Size& viewport_size) { 113 const gfx::Size& viewport_size) {
122 host_impl_.SetViewportSize(viewport_size); 114 host_impl_.SetViewportSize(viewport_size);
123 host_impl_.pending_tree()->UpdateDrawProperties(); 115 host_impl_.pending_tree()->UpdateDrawProperties();
124 116
125 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 117 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
126 SMOOTHNESS_TAKES_PRIORITY, 118 SMOOTHNESS_TAKES_PRIORITY,
127 NEW_CONTENT_TAKES_PRIORITY}; 119 NEW_CONTENT_TAKES_PRIORITY};
128 int priority_count = 0; 120 int priority_count = 0;
129 timer_.Reset(); 121 timer_.Reset();
130 do { 122 do {
131 int count = num_tiles; 123 int count = num_tiles;
132 scoped_ptr<TilingSetEvictionQueue> queue = 124 scoped_ptr<TilingSetEvictionQueue> queue =
133 pending_layer_->CreateEvictionQueue(priorities[priority_count]); 125 pending_layer_->CreateEvictionQueue(priorities[priority_count]);
134 while (count--) { 126 while (count--) {
135 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; 127 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
136 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; 128 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
137 queue->Pop(); 129 queue->Pop();
138 } 130 }
139 priority_count = (priority_count + 1) % arraysize(priorities); 131 priority_count = (priority_count + 1) % arraysize(priorities);
140 timer_.NextLap(); 132 timer_.NextLap();
141 } while (!timer_.HasTimeLimitExpired()); 133 } while (!timer_.HasTimeLimitExpired());
142 134
143 perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate", 135 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate",
144 "", 136 "", test_name, timer_.LapsPerSecond(), "runs/s",
145 test_name,
146 timer_.LapsPerSecond(),
147 "runs/s",
148 true); 137 true);
149 } 138 }
150 139
151 void RunEvictionQueueConstructTest(const std::string& test_name, 140 void RunEvictionQueueConstructTest(const std::string& test_name,
152 const gfx::Rect& viewport) { 141 const gfx::Rect& viewport) {
153 host_impl_.SetViewportSize(viewport.size()); 142 host_impl_.SetViewportSize(viewport.size());
154 pending_layer_->SetScrollOffset( 143 pending_layer_->SetScrollOffset(
155 gfx::ScrollOffset(viewport.x(), viewport.y())); 144 gfx::ScrollOffset(viewport.x(), viewport.y()));
156 host_impl_.pending_tree()->UpdateDrawProperties(); 145 host_impl_.pending_tree()->UpdateDrawProperties();
157 146
158 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 147 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
159 SMOOTHNESS_TAKES_PRIORITY, 148 SMOOTHNESS_TAKES_PRIORITY,
160 NEW_CONTENT_TAKES_PRIORITY}; 149 NEW_CONTENT_TAKES_PRIORITY};
161 int priority_count = 0; 150 int priority_count = 0;
162 timer_.Reset(); 151 timer_.Reset();
163 do { 152 do {
164 scoped_ptr<TilingSetEvictionQueue> queue = 153 scoped_ptr<TilingSetEvictionQueue> queue =
165 pending_layer_->CreateEvictionQueue(priorities[priority_count]); 154 pending_layer_->CreateEvictionQueue(priorities[priority_count]);
166 priority_count = (priority_count + 1) % arraysize(priorities); 155 priority_count = (priority_count + 1) % arraysize(priorities);
167 timer_.NextLap(); 156 timer_.NextLap();
168 } while (!timer_.HasTimeLimitExpired()); 157 } while (!timer_.HasTimeLimitExpired());
169 158
170 perf_test::PrintResult("layer_eviction_tile_iterator_construct", 159 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name,
171 "", 160 timer_.LapsPerSecond(), "runs/s", true);
172 test_name,
173 timer_.LapsPerSecond(),
174 "runs/s",
175 true);
176 } 161 }
177 162
178 protected: 163 protected:
179 TestSharedBitmapManager shared_bitmap_manager_; 164 TestSharedBitmapManager shared_bitmap_manager_;
180 FakeImplProxy proxy_; 165 FakeImplProxy proxy_;
181 FakeLayerTreeHostImpl host_impl_; 166 FakeLayerTreeHostImpl host_impl_;
182 FakePictureLayerImpl* pending_layer_; 167 FakePictureLayerImpl* pending_layer_;
183 LapTimer timer_; 168 LapTimer timer_;
184 169
185 private: 170 private:
186 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); 171 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest);
187 }; 172 };
188 173
189 // TODO(vmpstr): Rename these tests once the perf numbers are in. 174 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) {
190 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstructAndIterate) {
191 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 175 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
192 176
193 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 177 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
194 178
195 pending_layer_->AddTiling(low_res_factor); 179 pending_layer_->AddTiling(low_res_factor);
196 pending_layer_->AddTiling(0.3f); 180 pending_layer_->AddTiling(0.3f);
197 pending_layer_->AddTiling(0.7f); 181 pending_layer_->AddTiling(0.7f);
198 pending_layer_->AddTiling(1.0f); 182 pending_layer_->AddTiling(1.0f);
199 pending_layer_->AddTiling(2.0f); 183 pending_layer_->AddTiling(2.0f);
200 184
201 RunRasterQueueConstructAndIterateTest("32_100x100", 32, gfx::Size(100, 100)); 185 RunRasterQueueConstructAndIterateTest("32_100x100", 32, gfx::Size(100, 100));
202 RunRasterQueueConstructAndIterateTest("32_500x500", 32, gfx::Size(500, 500)); 186 RunRasterQueueConstructAndIterateTest("32_500x500", 32, gfx::Size(500, 500));
203 RunRasterQueueConstructAndIterateTest("64_100x100", 64, gfx::Size(100, 100)); 187 RunRasterQueueConstructAndIterateTest("64_100x100", 64, gfx::Size(100, 100));
204 RunRasterQueueConstructAndIterateTest("64_500x500", 64, gfx::Size(500, 500)); 188 RunRasterQueueConstructAndIterateTest("64_500x500", 64, gfx::Size(500, 500));
205 } 189 }
206 190
207 // TODO(vmpstr): Rename these tests once the perf numbers are in. 191 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstruct) {
208 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstruct) {
209 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 192 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
210 193
211 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 194 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
212 195
213 pending_layer_->AddTiling(low_res_factor); 196 pending_layer_->AddTiling(low_res_factor);
214 pending_layer_->AddTiling(0.3f); 197 pending_layer_->AddTiling(0.3f);
215 pending_layer_->AddTiling(0.7f); 198 pending_layer_->AddTiling(0.7f);
216 pending_layer_->AddTiling(1.0f); 199 pending_layer_->AddTiling(1.0f);
217 pending_layer_->AddTiling(2.0f); 200 pending_layer_->AddTiling(2.0f);
218 201
219 RunRasterQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 202 RunRasterQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
220 RunRasterQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 203 RunRasterQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
221 RunRasterQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 204 RunRasterQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
222 } 205 }
223 206
224 // TODO(e_hakkinen): Rename these tests once the perf numbers are in. 207 TEST_F(PictureLayerImplPerfTest, TilingSetEvictionQueueConstructAndIterate) {
225 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstructAndIterate) {
226 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 208 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
227 209
228 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 210 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
229 211
230 std::vector<Tile*> all_tiles; 212 std::vector<Tile*> all_tiles;
231 AddTiling(low_res_factor, pending_layer_, &all_tiles); 213 AddTiling(low_res_factor, pending_layer_, &all_tiles);
232 AddTiling(0.3f, pending_layer_, &all_tiles); 214 AddTiling(0.3f, pending_layer_, &all_tiles);
233 AddTiling(0.7f, pending_layer_, &all_tiles); 215 AddTiling(0.7f, pending_layer_, &all_tiles);
234 AddTiling(1.0f, pending_layer_, &all_tiles); 216 AddTiling(1.0f, pending_layer_, &all_tiles);
235 AddTiling(2.0f, pending_layer_, &all_tiles); 217 AddTiling(2.0f, pending_layer_, &all_tiles);
236 218
237 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 219 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
238 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 220 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
239 221
240 RunEvictionQueueConstructAndIterateTest( 222 RunEvictionQueueConstructAndIterateTest(
241 "32_100x100", 32, gfx::Size(100, 100)); 223 "32_100x100", 32, gfx::Size(100, 100));
242 RunEvictionQueueConstructAndIterateTest( 224 RunEvictionQueueConstructAndIterateTest(
243 "32_500x500", 32, gfx::Size(500, 500)); 225 "32_500x500", 32, gfx::Size(500, 500));
244 RunEvictionQueueConstructAndIterateTest( 226 RunEvictionQueueConstructAndIterateTest(
245 "64_100x100", 64, gfx::Size(100, 100)); 227 "64_100x100", 64, gfx::Size(100, 100));
246 RunEvictionQueueConstructAndIterateTest( 228 RunEvictionQueueConstructAndIterateTest(
247 "64_500x500", 64, gfx::Size(500, 500)); 229 "64_500x500", 64, gfx::Size(500, 500));
248 } 230 }
249 231
250 // TODO(e_hakkinen): Rename these tests once the perf numbers are in. 232 TEST_F(PictureLayerImplPerfTest, TilingSetEvictionQueueConstruct) {
251 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstruct) {
252 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 233 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
253 234
254 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 235 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
255 236
256 std::vector<Tile*> all_tiles; 237 std::vector<Tile*> all_tiles;
257 AddTiling(low_res_factor, pending_layer_, &all_tiles); 238 AddTiling(low_res_factor, pending_layer_, &all_tiles);
258 AddTiling(0.3f, pending_layer_, &all_tiles); 239 AddTiling(0.3f, pending_layer_, &all_tiles);
259 AddTiling(0.7f, pending_layer_, &all_tiles); 240 AddTiling(0.7f, pending_layer_, &all_tiles);
260 AddTiling(1.0f, pending_layer_, &all_tiles); 241 AddTiling(1.0f, pending_layer_, &all_tiles);
261 AddTiling(2.0f, pending_layer_, &all_tiles); 242 AddTiling(2.0f, pending_layer_, &all_tiles);
262 243
263 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 244 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
264 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 245 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
265 246
266 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 247 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
267 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 248 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
268 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 249 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
269 } 250 }
270 251
271 } // namespace 252 } // namespace
272 } // namespace cc 253 } // 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