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

Side by Side Diff: base/threading/thread_perftest.cc

Issue 551183002: Microbenchmark for the cost of posting tasks to different pump types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/format_macros.h"
darin (slow to review) 2014/09/28 03:42:20 nit: are these includes needed?
8 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/strings/stringprintf.h"
9 #include "base/synchronization/condition_variable.h" 11 #include "base/synchronization/condition_variable.h"
10 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
11 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
13 #include "base/time/time.h" 15 #include "base/time/time.h"
14 #include "build/build_config.h" 16 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/perf/perf_test.h" 18 #include "testing/perf/perf_test.h"
17 19
18 #if defined(OS_POSIX) 20 #if defined(OS_POSIX)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 base::ConditionVariable cond_; 254 base::ConditionVariable cond_;
253 bool signaled_; 255 bool signaled_;
254 }; 256 };
255 257
256 // This is meant to test the absolute minimal context switching time 258 // This is meant to test the absolute minimal context switching time
257 // using our own base synchronization code. 259 // using our own base synchronization code.
258 typedef EventPerfTest<ConditionVariableEvent> ConditionVariablePerfTest; 260 typedef EventPerfTest<ConditionVariableEvent> ConditionVariablePerfTest;
259 TEST_F(ConditionVariablePerfTest, EventPingPong) { 261 TEST_F(ConditionVariablePerfTest, EventPingPong) {
260 RunPingPongTest("4_ConditionVariable_Threads", 4); 262 RunPingPongTest("4_ConditionVariable_Threads", 4);
261 } 263 }
262
263 #if defined(OS_POSIX) 264 #if defined(OS_POSIX)
264 265
265 // Absolutely 100% minimal posix waitable event. If there is a better/faster 266 // Absolutely 100% minimal posix waitable event. If there is a better/faster
266 // way to force a context switch, we should use that instead. 267 // way to force a context switch, we should use that instead.
267 class PthreadEvent { 268 class PthreadEvent {
268 public: 269 public:
269 PthreadEvent(bool manual_reset, bool initially_signaled) { 270 PthreadEvent(bool manual_reset, bool initially_signaled) {
270 DCHECK(!manual_reset); 271 DCHECK(!manual_reset);
271 DCHECK(!initially_signaled); 272 DCHECK(!initially_signaled);
272 pthread_mutex_init(&mutex_, 0); 273 pthread_mutex_init(&mutex_, 0);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 typedef EventPerfTest<PthreadEvent> PthreadEventPerfTest; 306 typedef EventPerfTest<PthreadEvent> PthreadEventPerfTest;
306 TEST_F(PthreadEventPerfTest, EventPingPong) { 307 TEST_F(PthreadEventPerfTest, EventPingPong) {
307 RunPingPongTest("4_PthreadCondVar_Threads", 4); 308 RunPingPongTest("4_PthreadCondVar_Threads", 4);
308 } 309 }
309 310
310 #endif 311 #endif
311 312
312 } // namespace 313 } // namespace
313 314
314 } // namespace base 315 } // namespace base
OLDNEW
« base/message_loop/message_loop.cc ('K') | « base/message_loop/message_pump_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698