summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_perftest_support.h
diff options
context:
space:
mode:
authormorrita <morrita@chromium.org>2014-09-09 12:35:24 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-09 19:41:40 +0000
commit373af03b7c0e1932c7ea3b832918b7767d47ff89 (patch)
tree5be2bbc870238a11e54e650434ddcf09472a9600 /ipc/ipc_perftest_support.h
parent182520b878bee21aad3500391cd51d486e37bf1e (diff)
downloadchromium_src-373af03b7c0e1932c7ea3b832918b7767d47ff89.zip
chromium_src-373af03b7c0e1932c7ea3b832918b7767d47ff89.tar.gz
chromium_src-373af03b7c0e1932c7ea3b832918b7767d47ff89.tar.bz2
Add ipc_mojo_perftests
This change adds ipc_mojo_perftests that runs the same benchmark as of ipc_perftests. Now head-to-head comparison becomes possible. For this change, whole ipc_perftests logic is extracted to ipc_perftest_support.cc to make it reusable by ipc_mojo_perftests. TEST=none BUG=none R=jam@chromium.org, darin@chromium.org, yuzhu@chromium.org Review URL: https://codereview.chromium.org/536213002 Cr-Commit-Position: refs/heads/master@{#293988}
Diffstat (limited to 'ipc/ipc_perftest_support.h')
-rw-r--r--ipc/ipc_perftest_support.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/ipc/ipc_perftest_support.h b/ipc/ipc_perftest_support.h
new file mode 100644
index 0000000..611a209
--- /dev/null
+++ b/ipc/ipc_perftest_support.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IPC_IPC_PERFTEST_SUPPORT_H_
+#define IPC_IPC_PERFTEST_SUPPORT_H_
+
+#include <vector>
+
+#include "ipc/ipc_test_base.h"
+
+namespace IPC {
+namespace test {
+
+class ChannelReflectorListener;
+
+class PingPongTestParams {
+ public:
+ PingPongTestParams(size_t size, int count)
+ : message_size_(size), message_count_(count) {
+ }
+
+ size_t message_size() const { return message_size_; }
+ int message_count() const { return message_count_; }
+
+ private:
+ size_t message_size_;
+ int message_count_;
+};
+
+class IPCChannelPerfTestBase : public IPCTestBase {
+ public:
+ static std::vector<PingPongTestParams> GetDefaultTestParams();
+
+ void RunTestChannelPingPong(
+ const std::vector<PingPongTestParams>& params_list);
+ void RunTestChannelProxyPingPong(
+ const std::vector<PingPongTestParams>& params_list);
+};
+
+class PingPongTestClient {
+ public:
+ PingPongTestClient();
+ virtual ~PingPongTestClient();
+
+ virtual scoped_ptr<Channel> CreateChannel(Listener* listener);
+ int RunMain();
+ scoped_refptr<base::TaskRunner> task_runner();
+
+ private:
+ base::MessageLoopForIO main_message_loop_;
+ scoped_ptr<ChannelReflectorListener> listener_;
+ scoped_ptr<Channel> channel_;
+};
+
+}
+}
+
+#endif // IPC_IPC_PERFTEST_SUPPORT_H_