aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-05-21 16:49:38 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-05-21 16:49:38 -0700
commitf526bd487aaffa27e72f855256126a1c33a9fc81 (patch)
tree89949f4170732900238f27a83504cc74376fd900 /test
parent30ecd2b8d901ddfbaa1b607fa514e96e5f49cb11 (diff)
parent30b39ec4a336d5263dc4c73acd670e3ab2e6a008 (diff)
Merge branch 'master' of github.com:grpc/grpc into qps_reporter_refactoring
Diffstat (limited to 'test')
-rw-r--r--test/cpp/qps/async_streaming_ping_pong_test.cc4
-rw-r--r--test/cpp/qps/async_unary_ping_pong_test.cc4
-rw-r--r--test/cpp/qps/driver.cc30
-rw-r--r--test/cpp/qps/driver.h15
-rwxr-xr-xtest/cpp/qps/qps-sweep.sh29
-rw-r--r--test/cpp/qps/qps_driver.cc8
-rw-r--r--test/cpp/qps/qps_test.cc4
-rw-r--r--test/cpp/qps/qpstest.proto2
-rwxr-xr-xtest/cpp/qps/single_run_localhost.sh28
-rw-r--r--test/cpp/qps/sync_streaming_ping_pong_test.cc4
-rw-r--r--test/cpp/qps/sync_unary_ping_pong_test.cc4
11 files changed, 100 insertions, 32 deletions
diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc
index dc972443ff..411df4d32a 100644
--- a/test/cpp/qps/async_streaming_ping_pong_test.cc
+++ b/test/cpp/qps/async_streaming_ping_pong_test.cc
@@ -67,8 +67,8 @@ static void RunAsyncStreamingPingPong() {
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
- GetReporter()->ReportQPS(result);
- GetReporter()->ReportLatency(result);
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportLatency(*result);
}
} // namespace testing
diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc
index 05bc08a320..eda31b5744 100644
--- a/test/cpp/qps/async_unary_ping_pong_test.cc
+++ b/test/cpp/qps/async_unary_ping_pong_test.cc
@@ -67,8 +67,8 @@ static void RunAsyncUnaryPingPong() {
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
- GetReporter()->ReportQPS(result);
- GetReporter()->ReportLatency(result);
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportLatency(*result);
}
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 6959f980ae..682d515ebe 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -77,13 +77,10 @@ static deque<string> get_hosts(const string& name) {
}
}
-ScenarioResult RunScenario(const ClientConfig& initial_client_config,
- size_t num_clients,
- const ServerConfig& server_config,
- size_t num_servers,
- int warmup_seconds,
- int benchmark_seconds,
- int spawn_local_worker_count) {
+std::unique_ptr<ScenarioResult> RunScenario(
+ const ClientConfig& initial_client_config, size_t num_clients,
+ const ServerConfig& server_config, size_t num_servers, int warmup_seconds,
+ int benchmark_seconds, int spawn_local_worker_count) {
// ClientContext allocator (all are destroyed at scope exit)
list<ClientContext> contexts;
auto alloc_context = [&contexts]() {
@@ -91,6 +88,11 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
return &contexts.back();
};
+ // To be added to the result, containing the final configuration used for
+ // client and config (incluiding host, etc.)
+ ClientConfig result_client_config;
+ ServerConfig result_server_config;
+
// Get client, server lists
auto workers = get_hosts("QPS_WORKERS");
ClientConfig client_config = initial_client_config;
@@ -139,6 +141,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
sd.stub = std::move(Worker::NewStub(
CreateChannel(workers[i], InsecureCredentials(), ChannelArguments())));
ServerArgs args;
+ result_server_config = server_config;
+ result_server_config.set_host(workers[i]);
*args.mutable_setup() = server_config;
sd.stream = std::move(sd.stub->RunServer(alloc_context()));
GPR_ASSERT(sd.stream->Write(args));
@@ -168,6 +172,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
cd.stub = std::move(Worker::NewStub(CreateChannel(
workers[i + num_servers], InsecureCredentials(), ChannelArguments())));
ClientArgs args;
+ result_client_config = client_config;
+ result_client_config.set_host(workers[i + num_servers]);
*args.mutable_setup() = client_config;
cd.stream = std::move(cd.stub->RunTest(alloc_context()));
GPR_ASSERT(cd.stream->Write(args));
@@ -208,7 +214,9 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds)));
// Finish a run
- ScenarioResult result;
+ std::unique_ptr<ScenarioResult> result(new ScenarioResult);
+ result->client_config = result_client_config;
+ result->server_config = result_server_config;
gpr_log(GPR_INFO, "Finishing");
for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server->stream->Write(server_mark));
@@ -219,14 +227,14 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server->stream->Read(&server_status));
const auto& stats = server_status.stats();
- result.server_resources.push_back(ResourceUsage{
+ result->server_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()});
}
for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client->stream->Read(&client_status));
const auto& stats = client_status.stats();
- result.latencies.MergeProto(stats.latencies());
- result.client_resources.push_back(ResourceUsage{
+ result->latencies.MergeProto(stats.latencies());
+ result->client_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()});
}
diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h
index eb7119a89d..5e9d4b3cb9 100644
--- a/test/cpp/qps/driver.h
+++ b/test/cpp/qps/driver.h
@@ -34,6 +34,8 @@
#ifndef TEST_QPS_DRIVER_H
#define TEST_QPS_DRIVER_H
+#include <memory>
+
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/qpstest.grpc.pb.h"
@@ -49,15 +51,14 @@ struct ScenarioResult {
Histogram latencies;
std::vector<ResourceUsage> client_resources;
std::vector<ResourceUsage> server_resources;
+ ClientConfig client_config;
+ ServerConfig server_config;
};
-ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config,
- size_t num_clients,
- const grpc::testing::ServerConfig& server_config,
- size_t num_servers,
- int warmup_seconds,
- int benchmark_seconds,
- int spawn_local_worker_count);
+std::unique_ptr<ScenarioResult> RunScenario(
+ const grpc::testing::ClientConfig& client_config, size_t num_clients,
+ const grpc::testing::ServerConfig& server_config, size_t num_servers,
+ int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count);
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/qps/qps-sweep.sh b/test/cpp/qps/qps-sweep.sh
index 7bc6eade2c..cb93201933 100755
--- a/test/cpp/qps/qps-sweep.sh
+++ b/test/cpp/qps/qps-sweep.sh
@@ -1,5 +1,34 @@
#!/bin/sh
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
if [ x"$QPS_WORKERS" == x ]; then
echo Error: Must set QPS_WORKERS variable in form \
"host:port,host:port,..." 1>&2
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index 2e491eeb05..0b6759a6ed 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -111,10 +111,10 @@ static void QpsDriver() {
client_config, FLAGS_num_clients, server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers);
- GetReporter()->ReportQPS(result);
- GetReporter()->ReportQPSPerCore(result, server_config);
- GetReporter()->ReportLatency(result);
- GetReporter()->ReportTimes(result);
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportQPSPerCore(*result, server_config);
+ GetReporter()->ReportLatency(*result);
+ GetReporter()->ReportTimes(*result);
}
} // namespace testing
diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc
index 03c9c2c423..63a37ae07e 100644
--- a/test/cpp/qps/qps_test.cc
+++ b/test/cpp/qps/qps_test.cc
@@ -67,8 +67,8 @@ static void RunQPS() {
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
- GetReporter()->ReportQPSPerCore(result, server_config);
- GetReporter()->ReportLatency(result);
+ GetReporter()->ReportQPSPerCore(*result, server_config);
+ GetReporter()->ReportLatency(*result);
}
} // namespace testing
diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto
index 1553ef5f07..122a7df1ac 100644
--- a/test/cpp/qps/qpstest.proto
+++ b/test/cpp/qps/qpstest.proto
@@ -102,6 +102,7 @@ message ClientConfig {
// only for async client:
optional int32 async_client_threads = 7;
optional RpcType rpc_type = 8 [default=UNARY];
+ optional string host = 9;
}
// Request current stats
@@ -129,6 +130,7 @@ message ServerConfig {
required ServerType server_type = 1;
optional int32 threads = 2 [default=1];
optional bool enable_ssl = 3 [default=false];
+ optional string host = 4;
}
message ServerArgs {
diff --git a/test/cpp/qps/single_run_localhost.sh b/test/cpp/qps/single_run_localhost.sh
index 2f60b4e49d..9d76f08f80 100755
--- a/test/cpp/qps/single_run_localhost.sh
+++ b/test/cpp/qps/single_run_localhost.sh
@@ -1,4 +1,32 @@
#!/bin/sh
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# performs a single qps run with one client and one server
diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc
index 776fbdde1c..d53905a779 100644
--- a/test/cpp/qps/sync_streaming_ping_pong_test.cc
+++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc
@@ -66,8 +66,8 @@ static void RunSynchronousStreamingPingPong() {
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
- GetReporter()->ReportQPS(result);
- GetReporter()->ReportLatency(result);
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportLatency(*result);
}
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc
index e79b820ce3..d276d13a43 100644
--- a/test/cpp/qps/sync_unary_ping_pong_test.cc
+++ b/test/cpp/qps/sync_unary_ping_pong_test.cc
@@ -66,8 +66,8 @@ static void RunSynchronousUnaryPingPong() {
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
- GetReporter()->ReportQPS(result);
- GetReporter()->ReportLatency(result);
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportLatency(*result);
}
} // namespace testing