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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Set up IPC channel and start client. | 226 // Set up IPC channel and start client. |
227 PerformanceChannelListener listener; | 227 PerformanceChannelListener listener; |
228 CreateChannel(&listener); | 228 CreateChannel(&listener); |
229 listener.Init(channel()); | 229 listener.Init(channel()); |
230 ASSERT_TRUE(ConnectChannel()); | 230 ASSERT_TRUE(ConnectChannel()); |
231 ASSERT_TRUE(StartClient()); | 231 ASSERT_TRUE(StartClient()); |
232 | 232 |
233 // Test several sizes. We use 12^N for message size, and limit the message | 233 // Test several sizes. We use 12^N for message size, and limit the message |
234 // count to keep the test duration reasonable. | 234 // count to keep the test duration reasonable. |
235 const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832}; | 235 const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832}; |
236 const size_t kMessageCount[5] = {50000, 50000, 50000, 12000, 1000}; | 236 const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000}; |
237 | 237 |
238 for (size_t i = 0; i < 5; i++) { | 238 for (size_t i = 0; i < 5; i++) { |
239 listener.SetTestParams(kMessageCount[i], kMsgSize[i]); | 239 listener.SetTestParams(kMessageCount[i], kMsgSize[i]); |
240 | 240 |
241 // This initial message will kick-start the ping-pong of messages. | 241 // This initial message will kick-start the ping-pong of messages. |
242 IPC::Message* message = | 242 IPC::Message* message = |
243 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); | 243 new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
244 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); | 244 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); |
245 message->WriteInt(-1); | 245 message->WriteInt(-1); |
246 message->WriteString("hello"); | 246 message->WriteString("hello"); |
(...skipping 22 matching lines...) Expand all Loading... |
269 IPC::Channel::MODE_CLIENT, | 269 IPC::Channel::MODE_CLIENT, |
270 &listener); | 270 &listener); |
271 listener.Init(&channel); | 271 listener.Init(&channel); |
272 CHECK(channel.Connect()); | 272 CHECK(channel.Connect()); |
273 | 273 |
274 base::MessageLoop::current()->Run(); | 274 base::MessageLoop::current()->Run(); |
275 return 0; | 275 return 0; |
276 } | 276 } |
277 | 277 |
278 } // namespace | 278 } // namespace |
OLD | NEW |