| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_perftest_support.h" | 5 #include "ipc/ipc_perftest_support.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 std::unique_ptr<base::PerfTimeLogger> perf_logger_; | 231 std::unique_ptr<base::PerfTimeLogger> perf_logger_; |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 IPCChannelPerfTestBase::IPCChannelPerfTestBase() = default; | 234 IPCChannelPerfTestBase::IPCChannelPerfTestBase() = default; |
| 235 IPCChannelPerfTestBase::~IPCChannelPerfTestBase() = default; | 235 IPCChannelPerfTestBase::~IPCChannelPerfTestBase() = default; |
| 236 | 236 |
| 237 std::vector<PingPongTestParams> | 237 std::vector<PingPongTestParams> |
| 238 IPCChannelPerfTestBase::GetDefaultTestParams() { | 238 IPCChannelPerfTestBase::GetDefaultTestParams() { |
| 239 // Test several sizes. We use 12^N for message size, and limit the message | 239 // Test several sizes. We use 12^N for message size, and limit the message |
| 240 // count to keep the test duration reasonable. | 240 // count to keep the test duration reasonable. |
| 241 #ifdef NDEBUG |
| 242 const int kMultiplier = 100; |
| 243 #else |
| 244 // Debug builds on Windows run these tests orders of magnitude more slowly. |
| 245 const int kMultiplier = 1; |
| 246 #endif |
| 241 std::vector<PingPongTestParams> list; | 247 std::vector<PingPongTestParams> list; |
| 242 list.push_back(PingPongTestParams(12, 50000)); | 248 list.push_back(PingPongTestParams(12, 500 * kMultiplier)); |
| 243 list.push_back(PingPongTestParams(144, 50000)); | 249 list.push_back(PingPongTestParams(144, 500 * kMultiplier)); |
| 244 list.push_back(PingPongTestParams(1728, 50000)); | 250 list.push_back(PingPongTestParams(1728, 500 * kMultiplier)); |
| 245 list.push_back(PingPongTestParams(20736, 12000)); | 251 list.push_back(PingPongTestParams(20736, 120 * kMultiplier)); |
| 246 list.push_back(PingPongTestParams(248832, 1000)); | 252 list.push_back(PingPongTestParams(248832, 10 * kMultiplier)); |
| 247 return list; | 253 return list; |
| 248 } | 254 } |
| 249 | 255 |
| 250 void IPCChannelPerfTestBase::RunTestChannelPingPong( | 256 void IPCChannelPerfTestBase::RunTestChannelPingPong( |
| 251 const std::vector<PingPongTestParams>& params) { | 257 const std::vector<PingPongTestParams>& params) { |
| 252 auto message_loop = base::MakeUnique<base::MessageLoopForIO>(); | 258 auto message_loop = base::MakeUnique<base::MessageLoopForIO>(); |
| 253 mojo::edk::test::ScopedIPCSupport ipc_support(message_loop->task_runner()); | 259 mojo::edk::test::ScopedIPCSupport ipc_support(message_loop->task_runner()); |
| 254 InitWithCustomMessageLoop("MojoPerfTestClient", std::move(message_loop)); | 260 InitWithCustomMessageLoop("MojoPerfTestClient", std::move(message_loop)); |
| 255 | 261 |
| 256 // Set up IPC channel and start client. | 262 // Set up IPC channel and start client. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 auto set_result = SetThreadAffinityMask(GetCurrentThread(), old_affinity_); | 387 auto set_result = SetThreadAffinityMask(GetCurrentThread(), old_affinity_); |
| 382 DCHECK_NE(0u, set_result); | 388 DCHECK_NE(0u, set_result); |
| 383 #elif defined(OS_LINUX) | 389 #elif defined(OS_LINUX) |
| 384 auto set_result = sched_setaffinity(0, sizeof(old_cpuset_), &old_cpuset_); | 390 auto set_result = sched_setaffinity(0, sizeof(old_cpuset_), &old_cpuset_); |
| 385 DCHECK_EQ(0, set_result); | 391 DCHECK_EQ(0, set_result); |
| 386 #endif | 392 #endif |
| 387 } | 393 } |
| 388 | 394 |
| 389 } // namespace test | 395 } // namespace test |
| 390 } // namespace IPC | 396 } // namespace IPC |
| OLD | NEW |