| 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/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/resources/direct_raster_worker_pool.h" | 8 #include "cc/resources/direct_raster_worker_pool.h" |
| 9 #include "cc/resources/image_raster_worker_pool.h" | 9 #include "cc/resources/image_raster_worker_pool.h" |
| 10 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 10 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 raster_worker_pool_->ScheduleTasks(&queue); | 237 raster_worker_pool_->ScheduleTasks(&queue); |
| 238 raster_worker_pool_->CheckForCompletedTasks(); | 238 raster_worker_pool_->CheckForCompletedTasks(); |
| 239 timer_.NextLap(); | 239 timer_.NextLap(); |
| 240 } while (!timer_.HasTimeLimitExpired()); | 240 } while (!timer_.HasTimeLimitExpired()); |
| 241 | 241 |
| 242 RasterTaskQueue empty; | 242 RasterTaskQueue empty; |
| 243 raster_worker_pool_->ScheduleTasks(&empty); | 243 raster_worker_pool_->ScheduleTasks(&empty); |
| 244 RunMessageLoopUntilAllTasksHaveCompleted(); | 244 RunMessageLoopUntilAllTasksHaveCompleted(); |
| 245 | 245 |
| 246 perf_test::PrintResult("schedule_tasks", | 246 perf_test::PrintResult("schedule_tasks", |
| 247 "", | 247 TestModifierString(), |
| 248 test_name, | 248 test_name, |
| 249 timer_.LapsPerSecond(), | 249 timer_.LapsPerSecond(), |
| 250 "runs/s", | 250 "runs/s", |
| 251 true); | 251 true); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void RunScheduleAlternateTasksTest(const std::string& test_name, | 254 void RunScheduleAlternateTasksTest(const std::string& test_name, |
| 255 unsigned num_raster_tasks, | 255 unsigned num_raster_tasks, |
| 256 unsigned num_image_decode_tasks) { | 256 unsigned num_image_decode_tasks) { |
| 257 const size_t kNumVersions = 2; | 257 const size_t kNumVersions = 2; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 275 raster_worker_pool_->CheckForCompletedTasks(); | 275 raster_worker_pool_->CheckForCompletedTasks(); |
| 276 ++count; | 276 ++count; |
| 277 timer_.NextLap(); | 277 timer_.NextLap(); |
| 278 } while (!timer_.HasTimeLimitExpired()); | 278 } while (!timer_.HasTimeLimitExpired()); |
| 279 | 279 |
| 280 RasterTaskQueue empty; | 280 RasterTaskQueue empty; |
| 281 raster_worker_pool_->ScheduleTasks(&empty); | 281 raster_worker_pool_->ScheduleTasks(&empty); |
| 282 RunMessageLoopUntilAllTasksHaveCompleted(); | 282 RunMessageLoopUntilAllTasksHaveCompleted(); |
| 283 | 283 |
| 284 perf_test::PrintResult("schedule_alternate_tasks", | 284 perf_test::PrintResult("schedule_alternate_tasks", |
| 285 "", | 285 TestModifierString(), |
| 286 test_name, | 286 test_name, |
| 287 timer_.LapsPerSecond(), | 287 timer_.LapsPerSecond(), |
| 288 "runs/s", | 288 "runs/s", |
| 289 true); | 289 true); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void RunScheduleAndExecuteTasksTest(const std::string& test_name, | 292 void RunScheduleAndExecuteTasksTest(const std::string& test_name, |
| 293 unsigned num_raster_tasks, | 293 unsigned num_raster_tasks, |
| 294 unsigned num_image_decode_tasks) { | 294 unsigned num_image_decode_tasks) { |
| 295 internal::WorkerPoolTask::Vector image_decode_tasks; | 295 internal::WorkerPoolTask::Vector image_decode_tasks; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 307 raster_worker_pool_->ScheduleTasks(&queue); | 307 raster_worker_pool_->ScheduleTasks(&queue); |
| 308 RunMessageLoopUntilAllTasksHaveCompleted(); | 308 RunMessageLoopUntilAllTasksHaveCompleted(); |
| 309 timer_.NextLap(); | 309 timer_.NextLap(); |
| 310 } while (!timer_.HasTimeLimitExpired()); | 310 } while (!timer_.HasTimeLimitExpired()); |
| 311 | 311 |
| 312 RasterTaskQueue empty; | 312 RasterTaskQueue empty; |
| 313 raster_worker_pool_->ScheduleTasks(&empty); | 313 raster_worker_pool_->ScheduleTasks(&empty); |
| 314 RunMessageLoopUntilAllTasksHaveCompleted(); | 314 RunMessageLoopUntilAllTasksHaveCompleted(); |
| 315 | 315 |
| 316 perf_test::PrintResult("schedule_and_execute_tasks", | 316 perf_test::PrintResult("schedule_and_execute_tasks", |
| 317 "", | 317 TestModifierString(), |
| 318 test_name, | 318 test_name, |
| 319 timer_.LapsPerSecond(), | 319 timer_.LapsPerSecond(), |
| 320 "runs/s", | 320 "runs/s", |
| 321 true); | 321 true); |
| 322 } | 322 } |
| 323 | 323 |
| 324 private: | 324 private: |
| 325 std::string TestModifierString() const { |
| 326 switch (GetParam()) { |
| 327 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: |
| 328 return std::string("_pixel_raster_worker_pool"); |
| 329 case RASTER_WORKER_POOL_TYPE_IMAGE: |
| 330 return std::string("_image_raster_worker_pool"); |
| 331 case RASTER_WORKER_POOL_TYPE_DIRECT: |
| 332 return std::string("_direct_raster_worker_pool"); |
| 333 } |
| 334 NOTREACHED(); |
| 335 return std::string(); |
| 336 } |
| 337 |
| 325 scoped_refptr<TestContextProvider> context_provider_; | 338 scoped_refptr<TestContextProvider> context_provider_; |
| 326 FakeOutputSurfaceClient output_surface_client_; | 339 FakeOutputSurfaceClient output_surface_client_; |
| 327 scoped_ptr<FakeOutputSurface> output_surface_; | 340 scoped_ptr<FakeOutputSurface> output_surface_; |
| 328 scoped_ptr<ResourceProvider> resource_provider_; | 341 scoped_ptr<ResourceProvider> resource_provider_; |
| 329 scoped_ptr<internal::TaskGraphRunner> task_graph_runner_; | 342 scoped_ptr<internal::TaskGraphRunner> task_graph_runner_; |
| 330 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 343 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
| 331 LapTimer timer_; | 344 LapTimer timer_; |
| 332 }; | 345 }; |
| 333 | 346 |
| 334 TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) { | 347 TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 359 } | 372 } |
| 360 | 373 |
| 361 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, | 374 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, |
| 362 RasterWorkerPoolPerfTest, | 375 RasterWorkerPoolPerfTest, |
| 363 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 376 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 364 RASTER_WORKER_POOL_TYPE_IMAGE, | 377 RASTER_WORKER_POOL_TYPE_IMAGE, |
| 365 RASTER_WORKER_POOL_TYPE_DIRECT)); | 378 RASTER_WORKER_POOL_TYPE_DIRECT)); |
| 366 | 379 |
| 367 } // namespace | 380 } // namespace |
| 368 } // namespace cc | 381 } // namespace cc |
| OLD | NEW |