aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/qps')
-rw-r--r--test/cpp/qps/client_async.cc11
-rw-r--r--test/cpp/qps/driver.cc44
-rw-r--r--test/cpp/qps/server.cc2
-rw-r--r--test/cpp/qps/server_async.cc6
-rw-r--r--test/cpp/qps/server_sync.cc2
-rw-r--r--test/cpp/qps/stats.h4
-rw-r--r--test/cpp/qps/timer.cc1
-rw-r--r--test/cpp/qps/worker.cc2
8 files changed, 37 insertions, 35 deletions
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 526f37a1fd..f995a63f49 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -144,7 +144,8 @@ class AsyncClient GRPC_FINAL : public Client {
int t = 0;
for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
- for (auto& channel : channels_) {
+ for (auto channel = channels_.begin(); channel != channels_.end();
+ channel++) {
auto* cq = cli_cqs_[t].get();
t = (t + 1) % cli_cqs_.size();
auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx,
@@ -152,7 +153,7 @@ class AsyncClient GRPC_FINAL : public Client {
return stub->AsyncUnaryCall(ctx, request, cq, tag);
};
- TestService::Stub* stub = channel.get_stub();
+ TestService::Stub* stub = channel->get_stub();
const SimpleRequest& request = request_;
new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
stub, request, start_req, check_done);
@@ -165,11 +166,11 @@ class AsyncClient GRPC_FINAL : public Client {
~AsyncClient() GRPC_OVERRIDE {
EndThreads();
- for (auto& cq : cli_cqs_) {
- cq->Shutdown();
+ for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
+ (*cq)->Shutdown();
void* got_tag;
bool ok;
- while (cq->Next(&got_tag, &ok)) {
+ while ((*cq)->Next(&got_tag, &ok)) {
delete ClientRpcContext::detag(got_tag);
}
}
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index d29ca1de94..64a53496ae 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -154,19 +154,19 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
server_mark.mutable_mark();
ClientArgs client_mark;
client_mark.mutable_mark();
- for (auto& server : servers) {
- GPR_ASSERT(server.stream->Write(server_mark));
+ for (auto server = servers.begin(); server != servers.end(); server++) {
+ GPR_ASSERT(server->stream->Write(server_mark));
}
- for (auto& client : clients) {
- GPR_ASSERT(client.stream->Write(client_mark));
+ for (auto client = clients.begin(); client != clients.end(); client++) {
+ GPR_ASSERT(client->stream->Write(client_mark));
}
ServerStatus server_status;
ClientStatus client_status;
- for (auto& server : servers) {
- GPR_ASSERT(server.stream->Read(&server_status));
+ for (auto server = servers.begin(); server != servers.end(); server++) {
+ GPR_ASSERT(server->stream->Read(&server_status));
}
- for (auto& client : clients) {
- GPR_ASSERT(client.stream->Read(&client_status));
+ for (auto client = clients.begin(); client != clients.end(); client++) {
+ GPR_ASSERT(client->stream->Read(&client_status));
}
// Wait some time
@@ -176,33 +176,33 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
// Finish a run
ScenarioResult result;
gpr_log(GPR_INFO, "Finishing");
- for (auto& server : servers) {
- GPR_ASSERT(server.stream->Write(server_mark));
+ for (auto server = servers.begin(); server != servers.end(); server++) {
+ GPR_ASSERT(server->stream->Write(server_mark));
}
- for (auto& client : clients) {
- GPR_ASSERT(client.stream->Write(client_mark));
+ for (auto client = clients.begin(); client != clients.end(); client++) {
+ GPR_ASSERT(client->stream->Write(client_mark));
}
- for (auto& server : servers) {
- GPR_ASSERT(server.stream->Read(&server_status));
+ 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{
stats.time_elapsed(), stats.time_user(), stats.time_system()});
}
- for (auto& client : clients) {
- GPR_ASSERT(client.stream->Read(&client_status));
+ 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{
stats.time_elapsed(), stats.time_user(), stats.time_system()});
}
- for (auto& client : clients) {
- GPR_ASSERT(client.stream->WritesDone());
- GPR_ASSERT(client.stream->Finish().IsOk());
+ for (auto client = clients.begin(); client != clients.end(); client++) {
+ GPR_ASSERT(client->stream->WritesDone());
+ GPR_ASSERT(client->stream->Finish().IsOk());
}
- for (auto& server : servers) {
- GPR_ASSERT(server.stream->WritesDone());
- GPR_ASSERT(server.stream->Finish().IsOk());
+ for (auto server = servers.begin(); server != servers.end(); server++) {
+ GPR_ASSERT(server->stream->WritesDone());
+ GPR_ASSERT(server->stream->Finish().IsOk());
}
return result;
}
diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc
index 6a207d8730..e1907b069b 100644
--- a/test/cpp/qps/server.cc
+++ b/test/cpp/qps/server.cc
@@ -137,7 +137,7 @@ static void RunServer() {
SimpleResponse response;
ServerBuilder builder;
- builder.AddPort(server_address, grpc::InsecureServerCredentials());
+ builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
std::unique_ptr<ThreadPool> pool(new ThreadPool(FLAGS_server_threads));
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index fcb5ac6d2f..7b81bd35a2 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -68,7 +68,7 @@ class AsyncQpsServerTest : public Server {
gpr_join_host_port(&server_address, "::", port);
ServerBuilder builder;
- builder.AddPort(server_address, InsecureServerCredentials());
+ builder.AddListeningPort(server_address, InsecureServerCredentials());
gpr_free(server_address);
builder.RegisterAsyncService(&async_service_);
@@ -105,8 +105,8 @@ class AsyncQpsServerTest : public Server {
~AsyncQpsServerTest() {
server_->Shutdown();
srv_cq_.Shutdown();
- for (auto& thr : threads_) {
- thr.join();
+ for (auto thr = threads_.begin(); thr != threads_.end(); thr++) {
+ thr->join();
}
while (!contexts_.empty()) {
delete contexts_.front();
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 5c6541989c..3e15fb61c0 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -84,7 +84,7 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
char* server_address = NULL;
gpr_join_host_port(&server_address, "::", port);
- builder.AddPort(server_address, InsecureServerCredentials());
+ builder.AddListeningPort(server_address, InsecureServerCredentials());
gpr_free(server_address);
builder.RegisterService(&service_);
diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h
index ca59390ad7..82dc03e3da 100644
--- a/test/cpp/qps/stats.h
+++ b/test/cpp/qps/stats.h
@@ -43,8 +43,8 @@ namespace testing {
template <class T, class F>
double sum(const T& container, F functor) {
double r = 0;
- for (auto v : container) {
- r += functor(v);
+ for (auto v = container.begin(); v != container.end(); v++) {
+ r += functor(*v);
}
return r;
}
diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc
index 3c1342041c..d1b6bc1e55 100644
--- a/test/cpp/qps/timer.cc
+++ b/test/cpp/qps/timer.cc
@@ -36,6 +36,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <grpc/support/time.h>
+#include <grpc++/config.h>
Timer::Timer() : start_(Sample()) {}
diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc
index faabfd1147..fdcd9d5069 100644
--- a/test/cpp/qps/worker.cc
+++ b/test/cpp/qps/worker.cc
@@ -210,7 +210,7 @@ static void RunServer() {
WorkerImpl service;
ServerBuilder builder;
- builder.AddPort(server_address, InsecureServerCredentials());
+ builder.AddListeningPort(server_address, InsecureServerCredentials());
builder.RegisterService(&service);
gpr_free(server_address);