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

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

Issue 23658023: Fix some missing const reference on function parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/worker_pool.h" 5 #include "cc/resources/worker_pool.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/base/completion_event.h" 8 #include "cc/base/completion_event.h"
9 #include "cc/test/lap_timer.h" 9 #include "cc/test/lap_timer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 // Overridden from testing::Test: 154 // Overridden from testing::Test:
155 virtual void SetUp() OVERRIDE { 155 virtual void SetUp() OVERRIDE {
156 worker_pool_ = PerfWorkerPool::Create(); 156 worker_pool_ = PerfWorkerPool::Create();
157 } 157 }
158 virtual void TearDown() OVERRIDE { 158 virtual void TearDown() OVERRIDE {
159 worker_pool_->Shutdown(); 159 worker_pool_->Shutdown();
160 worker_pool_->CheckForCompletedTasks(); 160 worker_pool_->CheckForCompletedTasks();
161 } 161 }
162 162
163 void AfterTest(const std::string test_name) { 163 void AfterTest(const std::string& test_name) {
164 // Format matches chrome/test/perf/perf_test.h:PrintResult 164 // Format matches chrome/test/perf/perf_test.h:PrintResult
165 printf( 165 printf(
166 "*RESULT %s: %.2f runs/s\n", test_name.c_str(), timer_.LapsPerSecond()); 166 "*RESULT %s: %.2f runs/s\n", test_name.c_str(), timer_.LapsPerSecond());
167 } 167 }
168 168
169 void RunScheduleTasksTest(const std::string test_name, 169 void RunScheduleTasksTest(const std::string& test_name,
170 unsigned max_depth, 170 unsigned max_depth,
171 unsigned num_children_per_node) { 171 unsigned num_children_per_node) {
172 timer_.Reset(); 172 timer_.Reset();
173 do { 173 do {
174 scoped_refptr<PerfControlWorkerPoolTaskImpl> leaf_task( 174 scoped_refptr<PerfControlWorkerPoolTaskImpl> leaf_task(
175 new PerfControlWorkerPoolTaskImpl); 175 new PerfControlWorkerPoolTaskImpl);
176 worker_pool_->ScheduleTasks( 176 worker_pool_->ScheduleTasks(
177 NULL, leaf_task.get(), max_depth, num_children_per_node); 177 NULL, leaf_task.get(), max_depth, num_children_per_node);
178 leaf_task->WaitForTaskToStartRunning(); 178 leaf_task->WaitForTaskToStartRunning();
179 worker_pool_->ScheduleTasks(NULL, NULL, 0, 0); 179 worker_pool_->ScheduleTasks(NULL, NULL, 0, 0);
180 worker_pool_->CheckForCompletedTasks(); 180 worker_pool_->CheckForCompletedTasks();
181 leaf_task->AllowTaskToFinish(); 181 leaf_task->AllowTaskToFinish();
182 timer_.NextLap(); 182 timer_.NextLap();
183 } while (!timer_.HasTimeLimitExpired()); 183 } while (!timer_.HasTimeLimitExpired());
184 184
185 perf_test::PrintResult("schedule_tasks", "", test_name, 185 perf_test::PrintResult("schedule_tasks", "", test_name,
186 timer_.LapsPerSecond(), "runs/s", true); 186 timer_.LapsPerSecond(), "runs/s", true);
187 } 187 }
188 188
189 void RunExecuteTasksTest(const std::string test_name, 189 void RunExecuteTasksTest(const std::string& test_name,
190 unsigned max_depth, 190 unsigned max_depth,
191 unsigned num_children_per_node) { 191 unsigned num_children_per_node) {
192 timer_.Reset(); 192 timer_.Reset();
193 do { 193 do {
194 scoped_refptr<PerfControlWorkerPoolTaskImpl> root_task( 194 scoped_refptr<PerfControlWorkerPoolTaskImpl> root_task(
195 new PerfControlWorkerPoolTaskImpl); 195 new PerfControlWorkerPoolTaskImpl);
196 worker_pool_->ScheduleTasks( 196 worker_pool_->ScheduleTasks(
197 root_task.get(), NULL, max_depth, num_children_per_node); 197 root_task.get(), NULL, max_depth, num_children_per_node);
198 root_task->WaitForTaskToStartRunning(); 198 root_task->WaitForTaskToStartRunning();
199 root_task->AllowTaskToFinish(); 199 root_task->AllowTaskToFinish();
(...skipping 26 matching lines...) Expand all
226 RunExecuteTasksTest("2_10", 2, 10); 226 RunExecuteTasksTest("2_10", 2, 10);
227 RunExecuteTasksTest("5_5", 5, 5); 227 RunExecuteTasksTest("5_5", 5, 5);
228 RunExecuteTasksTest("10_2", 10, 2); 228 RunExecuteTasksTest("10_2", 10, 2);
229 RunExecuteTasksTest("1000_1", 1000, 1); 229 RunExecuteTasksTest("1000_1", 1000, 1);
230 RunExecuteTasksTest("10_1", 10, 1); 230 RunExecuteTasksTest("10_1", 10, 1);
231 } 231 }
232 232
233 } // namespace 233 } // namespace
234 234
235 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698