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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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 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 "platform/scheduler/base/task_queue_manager.h" 5 #include "platform/scheduler/base/task_queue_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 i++) { 119 i++) {
120 // Choose a queue weighted towards queue 0. 120 // Choose a queue weighted towards queue 0.
121 unsigned int queue = num_tasks_to_post_ % (num_queues_ + 1); 121 unsigned int queue = num_tasks_to_post_ % (num_queues_ + 1);
122 if (queue == num_queues_) { 122 if (queue == num_queues_) {
123 queue = 0; 123 queue = 0;
124 } 124 }
125 // Simulate a mix of short and longer delays. 125 // Simulate a mix of short and longer delays.
126 unsigned int delay = 126 unsigned int delay =
127 num_tasks_to_post_ % 2 ? 1 : (10 + num_tasks_to_post_ % 10); 127 num_tasks_to_post_ % 2 ? 1 : (10 + num_tasks_to_post_ % 10);
128 queues_[queue]->PostDelayedTask( 128 queues_[queue]->PostDelayedTask(
129 FROM_HERE, base::Bind(&TaskQueueManagerPerfTest::TestDelayedTask, 129 FROM_HERE,
130 base::Unretained(this)), 130 base::Bind(&TaskQueueManagerPerfTest::TestDelayedTask,
131 base::Unretained(this)),
131 base::TimeDelta::FromMilliseconds(delay)); 132 base::TimeDelta::FromMilliseconds(delay));
132 num_tasks_in_flight_++; 133 num_tasks_in_flight_++;
133 num_tasks_to_post_--; 134 num_tasks_to_post_--;
134 } 135 }
135 } 136 }
136 137
137 void ResetAndCallTestDelayedTask(unsigned int num_tasks_to_run) { 138 void ResetAndCallTestDelayedTask(unsigned int num_tasks_to_run) {
138 num_tasks_in_flight_ = 1; 139 num_tasks_in_flight_ = 1;
139 num_tasks_to_post_ = num_tasks_to_run; 140 num_tasks_to_post_ = num_tasks_to_run;
140 num_tasks_to_run_ = num_tasks_to_run; 141 num_tasks_to_run_ = num_tasks_to_run;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 Benchmark("run 10000 delayed tasks with eight queues", 216 Benchmark("run 10000 delayed tasks with eight queues",
216 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask, 217 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask,
217 base::Unretained(this), 10000)); 218 base::Unretained(this), 10000));
218 } 219 }
219 220
220 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs 221 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs
221 // delayed tasks. 222 // delayed tasks.
222 223
223 } // namespace scheduler 224 } // namespace scheduler
224 } // namespace blink 225 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698