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/image_raster_worker_pool.h" | 8 #include "cc/resources/image_raster_worker_pool.h" |
9 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 9 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 raster_worker_pool_->ScheduleTasks(&tasks); | 249 raster_worker_pool_->ScheduleTasks(&tasks); |
250 raster_worker_pool_->CheckForCompletedTasks(); | 250 raster_worker_pool_->CheckForCompletedTasks(); |
251 timer_.NextLap(); | 251 timer_.NextLap(); |
252 } while (!timer_.HasTimeLimitExpired()); | 252 } while (!timer_.HasTimeLimitExpired()); |
253 | 253 |
254 RasterWorkerPool::RasterTask::Queue empty; | 254 RasterWorkerPool::RasterTask::Queue empty; |
255 raster_worker_pool_->ScheduleTasks(&empty); | 255 raster_worker_pool_->ScheduleTasks(&empty); |
256 raster_worker_pool_->CheckForCompletedTasks(); | 256 raster_worker_pool_->CheckForCompletedTasks(); |
257 | 257 |
258 perf_test::PrintResult("schedule_tasks", | 258 perf_test::PrintResult("schedule_tasks", |
259 "", | 259 TestModifierString(), |
260 test_name, | 260 test_name, |
261 timer_.LapsPerSecond(), | 261 timer_.LapsPerSecond(), |
262 "runs/s", | 262 "runs/s", |
263 true); | 263 true); |
264 } | 264 } |
265 | 265 |
266 void RunScheduleAlternateTasksTest(const std::string& test_name, | 266 void RunScheduleAlternateTasksTest(const std::string& test_name, |
267 unsigned num_raster_tasks, | 267 unsigned num_raster_tasks, |
268 unsigned num_image_decode_tasks) { | 268 unsigned num_image_decode_tasks) { |
269 const size_t kNumVersions = 2; | 269 const size_t kNumVersions = 2; |
(...skipping 17 matching lines...) Expand all Loading... | |
287 raster_worker_pool_->CheckForCompletedTasks(); | 287 raster_worker_pool_->CheckForCompletedTasks(); |
288 ++count; | 288 ++count; |
289 timer_.NextLap(); | 289 timer_.NextLap(); |
290 } while (!timer_.HasTimeLimitExpired()); | 290 } while (!timer_.HasTimeLimitExpired()); |
291 | 291 |
292 RasterWorkerPool::RasterTask::Queue empty; | 292 RasterWorkerPool::RasterTask::Queue empty; |
293 raster_worker_pool_->ScheduleTasks(&empty); | 293 raster_worker_pool_->ScheduleTasks(&empty); |
294 raster_worker_pool_->CheckForCompletedTasks(); | 294 raster_worker_pool_->CheckForCompletedTasks(); |
295 | 295 |
296 perf_test::PrintResult("schedule_alternate_tasks", | 296 perf_test::PrintResult("schedule_alternate_tasks", |
297 "", | 297 TestModifierString(), |
298 test_name, | 298 test_name, |
299 timer_.LapsPerSecond(), | 299 timer_.LapsPerSecond(), |
300 "runs/s", | 300 "runs/s", |
301 true); | 301 true); |
302 } | 302 } |
303 | 303 |
304 void RunScheduleAndExecuteTasksTest(const std::string& test_name, | 304 void RunScheduleAndExecuteTasksTest(const std::string& test_name, |
305 unsigned num_raster_tasks, | 305 unsigned num_raster_tasks, |
306 unsigned num_image_decode_tasks) { | 306 unsigned num_image_decode_tasks) { |
307 Task::Vector image_decode_tasks; | 307 Task::Vector image_decode_tasks; |
(...skipping 13 matching lines...) Expand all Loading... | |
321 continue; | 321 continue; |
322 raster_worker_pool_->CheckForCompletedTasks(); | 322 raster_worker_pool_->CheckForCompletedTasks(); |
323 timer_.NextLap(); | 323 timer_.NextLap(); |
324 } while (!timer_.HasTimeLimitExpired()); | 324 } while (!timer_.HasTimeLimitExpired()); |
325 | 325 |
326 RasterWorkerPool::RasterTask::Queue empty; | 326 RasterWorkerPool::RasterTask::Queue empty; |
327 raster_worker_pool_->ScheduleTasks(&empty); | 327 raster_worker_pool_->ScheduleTasks(&empty); |
328 raster_worker_pool_->CheckForCompletedTasks(); | 328 raster_worker_pool_->CheckForCompletedTasks(); |
329 | 329 |
330 perf_test::PrintResult("schedule_and_execute_tasks", | 330 perf_test::PrintResult("schedule_and_execute_tasks", |
331 "", | 331 TestModifierString(), |
332 test_name, | 332 test_name, |
333 timer_.LapsPerSecond(), | 333 timer_.LapsPerSecond(), |
334 "runs/s", | 334 "runs/s", |
335 true); | 335 true); |
336 } | 336 } |
337 | 337 |
338 private: | 338 private: |
339 std::string TestModifierString() const { | |
340 switch (GetParam()) { | |
341 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: | |
342 return std::string("_pixel_raster_worker_pool"); | |
343 case RASTER_WORKER_POOL_TYPE_IMAGE: | |
344 return std::string("_image_raster_worker_pool"); | |
345 default: | |
reveman
2014/02/14 23:40:16
Please remove this "default:" case and move NOTREA
alokp
2014/02/15 00:26:11
Done.
| |
346 NOTREACHED(); | |
347 } | |
348 return std::string(); | |
349 } | |
350 | |
339 scoped_refptr<TestContextProvider> context_provider_; | 351 scoped_refptr<TestContextProvider> context_provider_; |
340 FakeOutputSurfaceClient output_surface_client_; | 352 FakeOutputSurfaceClient output_surface_client_; |
341 scoped_ptr<FakeOutputSurface> output_surface_; | 353 scoped_ptr<FakeOutputSurface> output_surface_; |
342 scoped_ptr<ResourceProvider> resource_provider_; | 354 scoped_ptr<ResourceProvider> resource_provider_; |
343 scoped_ptr<internal::TaskGraphRunner> task_graph_runner_; | 355 scoped_ptr<internal::TaskGraphRunner> task_graph_runner_; |
344 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 356 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
345 std::vector<RasterWorkerPool::RasterTask> tasks_; | 357 std::vector<RasterWorkerPool::RasterTask> tasks_; |
346 LapTimer timer_; | 358 LapTimer timer_; |
347 }; | 359 }; |
348 | 360 |
(...skipping 24 matching lines...) Expand all Loading... | |
373 RunScheduleAndExecuteTasksTest("32_4", 32, 4); | 385 RunScheduleAndExecuteTasksTest("32_4", 32, 4); |
374 } | 386 } |
375 | 387 |
376 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, | 388 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, |
377 RasterWorkerPoolPerfTest, | 389 RasterWorkerPoolPerfTest, |
378 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 390 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
379 RASTER_WORKER_POOL_TYPE_IMAGE)); | 391 RASTER_WORKER_POOL_TYPE_IMAGE)); |
380 | 392 |
381 } // namespace | 393 } // namespace |
382 } // namespace cc | 394 } // namespace cc |
OLD | NEW |