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

Side by Side Diff: base/message_loop/message_pump_perftest.cc

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « base/message_loop/message_loop_proxy_impl.cc ('k') | base/metrics/statistics_recorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/format_macros.h" 6 #include "base/format_macros.h"
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/synchronization/condition_variable.h" 9 #include "base/synchronization/condition_variable.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/perf/perf_test.h" 16 #include "testing/perf/perf_test.h"
17 17
18 #if defined(OS_ANDROID) 18 #if defined(OS_ANDROID)
19 #include "base/android/java_handler_thread.h" 19 #include "base/android/java_handler_thread.h"
20 #endif 20 #endif
21 21
22 namespace base { 22 namespace base {
23 namespace {
24 23
25 class ScheduleWorkTest : public testing::Test { 24 class ScheduleWorkTest : public testing::Test {
26 public: 25 public:
27 ScheduleWorkTest() : counter_(0) {} 26 ScheduleWorkTest() : counter_(0) {}
28 27
29 void Increment(uint64_t amount) { counter_ += amount; } 28 void Increment(uint64_t amount) { counter_ += amount; }
30 29
31 void Schedule(int index) { 30 void Schedule(int index) {
32 base::TimeTicks start = base::TimeTicks::Now(); 31 base::TimeTicks start = base::TimeTicks::Now();
33 base::TimeTicks thread_start; 32 base::TimeTicks thread_start;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 216
218 TEST_F(ScheduleWorkTest, ThreadTimeToJavaFromTwoThreads) { 217 TEST_F(ScheduleWorkTest, ThreadTimeToJavaFromTwoThreads) {
219 ScheduleWork(MessageLoop::TYPE_JAVA, 2); 218 ScheduleWork(MessageLoop::TYPE_JAVA, 2);
220 } 219 }
221 220
222 TEST_F(ScheduleWorkTest, ThreadTimeToJavaFromFourThreads) { 221 TEST_F(ScheduleWorkTest, ThreadTimeToJavaFromFourThreads) {
223 ScheduleWork(MessageLoop::TYPE_JAVA, 4); 222 ScheduleWork(MessageLoop::TYPE_JAVA, 4);
224 } 223 }
225 #endif 224 #endif
226 225
227 static void DoNothing() {
228 }
229
230 class FakeMessagePump : public MessagePump { 226 class FakeMessagePump : public MessagePump {
231 public: 227 public:
232 FakeMessagePump() {} 228 FakeMessagePump() {}
233 ~FakeMessagePump() override {} 229 ~FakeMessagePump() override {}
234 230
235 void Run(Delegate* delegate) override {} 231 void Run(Delegate* delegate) override {}
236 232
237 void Quit() override {} 233 void Quit() override {}
238 void ScheduleWork() override {} 234 void ScheduleWork() override {}
239 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override {} 235 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override {}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 278 }
283 279
284 TEST_F(PostTaskTest, TenTasksPerReload) { 280 TEST_F(PostTaskTest, TenTasksPerReload) {
285 Run(10000, 10); 281 Run(10000, 10);
286 } 282 }
287 283
288 TEST_F(PostTaskTest, OneHundredTasksPerReload) { 284 TEST_F(PostTaskTest, OneHundredTasksPerReload) {
289 Run(1000, 100); 285 Run(1000, 100);
290 } 286 }
291 287
292 } // namespace
293 } // namespace base 288 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop_proxy_impl.cc ('k') | base/metrics/statistics_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698