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

Side by Side Diff: cc/tiles/tile_manager_perftest.cc

Issue 1591513002: cc: Early out of UpdateTiles for resoureceless draw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 11 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 | « cc/test/fake_picture_layer_impl.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 void RunRasterQueueConstructTest(const std::string& test_name, 182 void RunRasterQueueConstructTest(const std::string& test_name,
183 int layer_count) { 183 int layer_count) {
184 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 184 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
185 SMOOTHNESS_TAKES_PRIORITY, 185 SMOOTHNESS_TAKES_PRIORITY,
186 NEW_CONTENT_TAKES_PRIORITY}; 186 NEW_CONTENT_TAKES_PRIORITY};
187 int priority_count = 0; 187 int priority_count = 0;
188 188
189 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); 189 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10);
190 bool resourceless_software_draw = false;
191 for (const auto& layer : layers) 190 for (const auto& layer : layers)
192 layer->UpdateTiles(resourceless_software_draw); 191 layer->UpdateTiles();
193 192
194 timer_.Reset(); 193 timer_.Reset();
195 do { 194 do {
196 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( 195 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
197 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); 196 priorities[priority_count], RasterTilePriorityQueue::Type::ALL));
198 priority_count = (priority_count + 1) % arraysize(priorities); 197 priority_count = (priority_count + 1) % arraysize(priorities);
199 timer_.NextLap(); 198 timer_.NextLap();
200 } while (!timer_.HasTimeLimitExpired()); 199 } while (!timer_.HasTimeLimitExpired());
201 200
202 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", 201 perf_test::PrintResult("tile_manager_raster_tile_queue_construct",
203 "", 202 "",
204 test_name, 203 test_name,
205 timer_.LapsPerSecond(), 204 timer_.LapsPerSecond(),
206 "runs/s", 205 "runs/s",
207 true); 206 true);
208 } 207 }
209 208
210 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, 209 void RunRasterQueueConstructAndIterateTest(const std::string& test_name,
211 int layer_count, 210 int layer_count,
212 int tile_count) { 211 int tile_count) {
213 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 212 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
214 SMOOTHNESS_TAKES_PRIORITY, 213 SMOOTHNESS_TAKES_PRIORITY,
215 NEW_CONTENT_TAKES_PRIORITY}; 214 NEW_CONTENT_TAKES_PRIORITY};
216 215
217 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); 216 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100);
218 bool resourceless_software_draw = false;
219 for (const auto& layer : layers) 217 for (const auto& layer : layers)
220 layer->UpdateTiles(resourceless_software_draw); 218 layer->UpdateTiles();
221 219
222 int priority_count = 0; 220 int priority_count = 0;
223 timer_.Reset(); 221 timer_.Reset();
224 do { 222 do {
225 int count = tile_count; 223 int count = tile_count;
226 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( 224 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
227 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); 225 priorities[priority_count], RasterTilePriorityQueue::Type::ALL));
228 while (count--) { 226 while (count--) {
229 ASSERT_FALSE(queue->IsEmpty()); 227 ASSERT_FALSE(queue->IsEmpty());
230 ASSERT_TRUE(queue->Top().tile()); 228 ASSERT_TRUE(queue->Top().tile());
(...skipping 13 matching lines...) Expand all
244 } 242 }
245 243
246 void RunEvictionQueueConstructTest(const std::string& test_name, 244 void RunEvictionQueueConstructTest(const std::string& test_name,
247 int layer_count) { 245 int layer_count) {
248 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 246 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
249 SMOOTHNESS_TAKES_PRIORITY, 247 SMOOTHNESS_TAKES_PRIORITY,
250 NEW_CONTENT_TAKES_PRIORITY}; 248 NEW_CONTENT_TAKES_PRIORITY};
251 int priority_count = 0; 249 int priority_count = 0;
252 250
253 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); 251 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10);
254 bool resourceless_software_draw = false;
255 for (const auto& layer : layers) { 252 for (const auto& layer : layers) {
256 layer->UpdateTiles(resourceless_software_draw); 253 layer->UpdateTiles();
257 for (size_t i = 0; i < layer->num_tilings(); ++i) { 254 for (size_t i = 0; i < layer->num_tilings(); ++i) {
258 tile_manager()->InitializeTilesWithResourcesForTesting( 255 tile_manager()->InitializeTilesWithResourcesForTesting(
259 layer->tilings()->tiling_at(i)->AllTilesForTesting()); 256 layer->tilings()->tiling_at(i)->AllTilesForTesting());
260 } 257 }
261 } 258 }
262 259
263 timer_.Reset(); 260 timer_.Reset();
264 do { 261 do {
265 scoped_ptr<EvictionTilePriorityQueue> queue( 262 scoped_ptr<EvictionTilePriorityQueue> queue(
266 host_impl_.BuildEvictionQueue(priorities[priority_count])); 263 host_impl_.BuildEvictionQueue(priorities[priority_count]));
(...skipping 12 matching lines...) Expand all
279 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name, 276 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name,
280 int layer_count, 277 int layer_count,
281 int tile_count) { 278 int tile_count) {
282 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 279 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
283 SMOOTHNESS_TAKES_PRIORITY, 280 SMOOTHNESS_TAKES_PRIORITY,
284 NEW_CONTENT_TAKES_PRIORITY}; 281 NEW_CONTENT_TAKES_PRIORITY};
285 int priority_count = 0; 282 int priority_count = 0;
286 283
287 std::vector<FakePictureLayerImpl*> layers = 284 std::vector<FakePictureLayerImpl*> layers =
288 CreateLayers(layer_count, tile_count); 285 CreateLayers(layer_count, tile_count);
289 bool resourceless_software_draw = false;
290 for (const auto& layer : layers) { 286 for (const auto& layer : layers) {
291 layer->UpdateTiles(resourceless_software_draw); 287 layer->UpdateTiles();
292 for (size_t i = 0; i < layer->num_tilings(); ++i) { 288 for (size_t i = 0; i < layer->num_tilings(); ++i) {
293 tile_manager()->InitializeTilesWithResourcesForTesting( 289 tile_manager()->InitializeTilesWithResourcesForTesting(
294 layer->tilings()->tiling_at(i)->AllTilesForTesting()); 290 layer->tilings()->tiling_at(i)->AllTilesForTesting());
295 } 291 }
296 } 292 }
297 293
298 timer_.Reset(); 294 timer_.Reset();
299 do { 295 do {
300 int count = tile_count; 296 int count = tile_count;
301 scoped_ptr<EvictionTilePriorityQueue> queue( 297 scoped_ptr<EvictionTilePriorityQueue> queue(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return state; 385 return state;
390 } 386 }
391 387
392 void RunPrepareTilesTest(const std::string& test_name, 388 void RunPrepareTilesTest(const std::string& test_name,
393 int layer_count, 389 int layer_count,
394 int approximate_tile_count_per_layer) { 390 int approximate_tile_count_per_layer) {
395 std::vector<FakePictureLayerImpl*> layers = 391 std::vector<FakePictureLayerImpl*> layers =
396 CreateLayers(layer_count, approximate_tile_count_per_layer); 392 CreateLayers(layer_count, approximate_tile_count_per_layer);
397 393
398 timer_.Reset(); 394 timer_.Reset();
399 bool resourceless_software_draw = false;
400 do { 395 do {
401 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 396 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
402 for (const auto& layer : layers) 397 for (const auto& layer : layers)
403 layer->UpdateTiles(resourceless_software_draw); 398 layer->UpdateTiles();
404 399
405 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); 400 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest());
406 tile_manager()->PrepareTiles(global_state); 401 tile_manager()->PrepareTiles(global_state);
407 tile_manager()->Flush(); 402 tile_manager()->Flush();
408 timer_.NextLap(); 403 timer_.NextLap();
409 } while (!timer_.HasTimeLimitExpired()); 404 } while (!timer_.HasTimeLimitExpired());
410 405
411 perf_test::PrintResult("prepare_tiles", "", test_name, 406 perf_test::PrintResult("prepare_tiles", "", test_name,
412 timer_.LapsPerSecond(), "runs/s", true); 407 timer_.LapsPerSecond(), "runs/s", true);
413 } 408 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); 475 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64);
481 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 476 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
482 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 477 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
483 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 478 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
484 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 479 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
485 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 480 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
486 } 481 }
487 482
488 } // namespace 483 } // namespace
489 } // namespace cc 484 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer_impl.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698