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

Side by Side Diff: cc/resources/task_graph_runner_perftest.cc

Issue 943813002: cc: Add TaskGraphRunner sub-namespaces with task concurrency limits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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/resources/task_graph_runner.h" 5 #include "cc/resources/task_graph_runner.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 } 222 }
223 223
224 void BuildTaskGraph(const PerfTaskImpl::Vector& top_level_tasks, 224 void BuildTaskGraph(const PerfTaskImpl::Vector& top_level_tasks,
225 const PerfTaskImpl::Vector& tasks, 225 const PerfTaskImpl::Vector& tasks,
226 const PerfTaskImpl::Vector& leaf_tasks, 226 const PerfTaskImpl::Vector& leaf_tasks,
227 TaskGraph* graph) { 227 TaskGraph* graph) {
228 DCHECK(graph->nodes.empty()); 228 DCHECK(graph->nodes.empty());
229 DCHECK(graph->edges.empty()); 229 DCHECK(graph->edges.empty());
230 230
231 int sub_namespace = 0;
232 int max_concurrent_tasks = 4;
233
231 for (PerfTaskImpl::Vector::const_iterator it = leaf_tasks.begin(); 234 for (PerfTaskImpl::Vector::const_iterator it = leaf_tasks.begin();
232 it != leaf_tasks.end(); 235 it != leaf_tasks.end();
233 ++it) { 236 ++it) {
234 graph->nodes.push_back(TaskGraph::Node(it->get(), 0u, 0u)); 237 graph->nodes.push_back(TaskGraph::Node(it->get(), 0u, 0u, sub_namespace,
238 max_concurrent_tasks));
235 } 239 }
236 240
237 for (PerfTaskImpl::Vector::const_iterator it = tasks.begin(); 241 for (PerfTaskImpl::Vector::const_iterator it = tasks.begin();
238 it != tasks.end(); 242 it != tasks.end();
239 ++it) { 243 ++it) {
240 graph->nodes.push_back(TaskGraph::Node(it->get(), 0u, leaf_tasks.size())); 244 graph->nodes.push_back(TaskGraph::Node(it->get(), 0u, leaf_tasks.size(),
245 sub_namespace,
246 max_concurrent_tasks));
241 247
242 for (PerfTaskImpl::Vector::const_iterator leaf_it = leaf_tasks.begin(); 248 for (PerfTaskImpl::Vector::const_iterator leaf_it = leaf_tasks.begin();
243 leaf_it != leaf_tasks.end(); 249 leaf_it != leaf_tasks.end();
244 ++leaf_it) { 250 ++leaf_it) {
245 graph->edges.push_back(TaskGraph::Edge(leaf_it->get(), it->get())); 251 graph->edges.push_back(TaskGraph::Edge(leaf_it->get(), it->get()));
246 } 252 }
247 253
248 for (PerfTaskImpl::Vector::const_iterator top_level_it = 254 for (PerfTaskImpl::Vector::const_iterator top_level_it =
249 top_level_tasks.begin(); 255 top_level_tasks.begin();
250 top_level_it != top_level_tasks.end(); 256 top_level_it != top_level_tasks.end();
251 ++top_level_it) { 257 ++top_level_it) {
252 graph->edges.push_back(TaskGraph::Edge(it->get(), top_level_it->get())); 258 graph->edges.push_back(TaskGraph::Edge(it->get(), top_level_it->get()));
253 } 259 }
254 } 260 }
255 261
256 for (PerfTaskImpl::Vector::const_iterator it = top_level_tasks.begin(); 262 for (PerfTaskImpl::Vector::const_iterator it = top_level_tasks.begin();
257 it != top_level_tasks.end(); 263 it != top_level_tasks.end();
258 ++it) { 264 ++it) {
259 graph->nodes.push_back(TaskGraph::Node(it->get(), 0u, tasks.size())); 265 graph->nodes.push_back(TaskGraph::Node(
266 it->get(), 0u, tasks.size(), sub_namespace, max_concurrent_tasks));
260 } 267 }
261 } 268 }
262 269
263 size_t CollectCompletedTasks(Task::Vector* completed_tasks) { 270 size_t CollectCompletedTasks(Task::Vector* completed_tasks) {
264 DCHECK(completed_tasks->empty()); 271 DCHECK(completed_tasks->empty());
265 task_graph_runner_->CollectCompletedTasks(namespace_token_, 272 task_graph_runner_->CollectCompletedTasks(namespace_token_,
266 completed_tasks); 273 completed_tasks);
267 return completed_tasks->size(); 274 return completed_tasks->size();
268 } 275 }
269 276
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); 310 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0);
304 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); 311 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0);
305 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); 312 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0);
306 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); 313 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0);
307 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); 314 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1);
308 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); 315 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1);
309 } 316 }
310 317
311 } // namespace 318 } // namespace
312 } // namespace cc 319 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698