blob: 88b9d373a11ead76453b234649ba411887e7eaab [file] [log] [blame]
Craig Tillere4860192015-02-23 17:10:41 -08001/*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34#include <gflags/gflags.h>
35
36#include "test/cpp/qps/driver.h"
37
Craig Tiller2d0f36c2015-02-23 23:16:17 -080038DEFINE_int32(num_clients, 1, "Number of client binaries");
39DEFINE_int32(num_servers, 1, "Number of server binaries");
Craig Tillere4860192015-02-23 17:10:41 -080040
Craig Tiller2d0f36c2015-02-23 23:16:17 -080041// Common config
42DEFINE_bool(enable_ssl, false, "Use SSL");
43
44// Server config
45DEFINE_int32(server_threads, 1, "Number of server threads");
46
47// Client config
48DEFINE_int32(client_threads, 1, "Number of client threads");
49DEFINE_int32(client_channels, 1, "Number of client channels");
50DEFINE_int32(num_rpcs, 10000, "Number of rpcs per client thread");
51DEFINE_int32(payload_size, 1, "Payload size");
52
53using grpc::testing::ClientConfig;
54using grpc::testing::ServerConfig;
Craig Tillere4860192015-02-23 17:10:41 -080055
56// In some distros, gflags is in the namespace google, and in some others,
57// in gflags. This hack is enabling us to find both.
58namespace google { }
59namespace gflags { }
60using namespace google;
61using namespace gflags;
62
63int main(int argc, char **argv) {
64 grpc_init();
65 ParseCommandLineFlags(&argc, &argv, true);
66
Craig Tiller2d0f36c2015-02-23 23:16:17 -080067 ClientConfig client_config;
68 client_config.set_enable_ssl(FLAGS_enable_ssl);
69 client_config.set_client_threads(FLAGS_client_threads);
70 client_config.set_client_channels(FLAGS_client_channels);
71 client_config.set_num_rpcs(FLAGS_num_rpcs);
72 client_config.set_payload_size(FLAGS_payload_size);
Craig Tillere4860192015-02-23 17:10:41 -080073
Craig Tiller2d0f36c2015-02-23 23:16:17 -080074 ServerConfig server_config;
75 server_config.set_threads(FLAGS_server_threads);
76 server_config.set_enable_ssl(FLAGS_enable_ssl);
77
78 RunScenario(client_config, FLAGS_num_clients, server_config, FLAGS_num_servers);
Craig Tillere4860192015-02-23 17:10:41 -080079
80 grpc_shutdown();
81 return 0;
82}
83