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

Side by Side Diff: components/scheduler/child/task_queue_manager_perftest.cc

Issue 987193002: Redirect the MessageLoop's task runner to the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/scheduler/child/task_queue_manager.h" 5 #include "components/scheduler/child/task_queue_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "components/scheduler/child/scheduler_message_loop_delegate.h" 9 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h"
10 #include "components/scheduler/child/task_queue.h" 10 #include "components/scheduler/child/task_queue.h"
11 #include "components/scheduler/child/task_queue_selector.h" 11 #include "components/scheduler/child/task_queue_selector.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/perf/perf_test.h" 13 #include "testing/perf/perf_test.h"
14 14
15 namespace scheduler { 15 namespace scheduler {
16 16
17 namespace { 17 namespace {
18 18
19 class SelectorForTest : public TaskQueueSelector { 19 class SelectorForTest : public TaskQueueSelector {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 max_tasks_in_flight_(0), 62 max_tasks_in_flight_(0),
63 num_tasks_in_flight_(0), 63 num_tasks_in_flight_(0),
64 num_tasks_to_post_(0), 64 num_tasks_to_post_(0),
65 num_tasks_to_run_(0) {} 65 num_tasks_to_run_(0) {}
66 66
67 void Initialize(size_t num_queues) { 67 void Initialize(size_t num_queues) {
68 num_queues_ = num_queues; 68 num_queues_ = num_queues;
69 message_loop_.reset(new base::MessageLoop()); 69 message_loop_.reset(new base::MessageLoop());
70 selector_ = make_scoped_ptr(new SelectorForTest); 70 selector_ = make_scoped_ptr(new SelectorForTest);
71 manager_ = make_scoped_ptr(new TaskQueueManager( 71 manager_ = make_scoped_ptr(new TaskQueueManager(
72 num_queues, SchedulerMessageLoopDelegate::Create(message_loop_.get()), 72 num_queues,
73 SchedulerTaskRunnerDelegateImpl::Create(message_loop_.get()),
73 selector_.get(), "fake.category", "fake.category.debug")); 74 selector_.get(), "fake.category", "fake.category.debug"));
74 } 75 }
75 76
76 void TestDelayedTask() { 77 void TestDelayedTask() {
77 if (--num_tasks_to_run_ == 0) { 78 if (--num_tasks_to_run_ == 0) {
78 message_loop_->Quit(); 79 message_loop_->Quit();
79 } 80 }
80 81
81 num_tasks_in_flight_--; 82 num_tasks_in_flight_--;
82 // NOTE there are only up to max_tasks_in_flight_ pending delayed tasks at 83 // NOTE there are only up to max_tasks_in_flight_ pending delayed tasks at
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 max_tasks_in_flight_ = 200; 168 max_tasks_in_flight_ = 200;
168 Benchmark("run 10000 delayed tasks with eight queues", 169 Benchmark("run 10000 delayed tasks with eight queues",
169 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask, 170 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask,
170 base::Unretained(this), 10000)); 171 base::Unretained(this), 10000));
171 } 172 }
172 173
173 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs 174 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs
174 // delayed tasks. 175 // delayed tasks.
175 176
176 } // namespace scheduler 177 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698