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.cc2
-rw-r--r--test/cpp/qps/driver.cc7
-rw-r--r--test/cpp/qps/histogram.h4
-rw-r--r--test/cpp/qps/interarrival.h4
-rw-r--r--test/cpp/qps/parse_json.cc4
-rw-r--r--test/cpp/qps/parse_json.h4
-rw-r--r--test/cpp/qps/qps_interarrival_test.cc8
-rw-r--r--test/cpp/qps/server_async.cc136
8 files changed, 82 insertions, 87 deletions
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index a541f94fa5..f7cdfc2bd7 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -149,9 +149,9 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
// Specify which protected members we are using since there is no
// member name resolution until the template types are fully resolved
public:
+ using Client::NextIssuer;
using Client::SetupLoadTest;
using Client::closed_loop_;
- using Client::NextIssuer;
using ClientImpl<StubType, RequestType>::cores_;
using ClientImpl<StubType, RequestType>::channels_;
using ClientImpl<StubType, RequestType>::request_;
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 5504c0b96a..22d039d4b7 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -43,10 +43,10 @@
#include "test/cpp/qps/stats.h"
#include "test/cpp/util/test_credentials_provider.h"
+using std::deque;
using std::list;
using std::thread;
using std::unique_ptr;
-using std::deque;
using std::vector;
namespace grpc {
@@ -147,9 +147,8 @@ static void postprocess_scenario_result(ScenarioResult* result) {
result->mutable_summary()->set_server_cpu_usage(0);
} else {
auto server_cpu_usage =
- 100 -
- 100 * average(result->server_stats(), ServerIdleCpuTime) /
- average(result->server_stats(), ServerTotalCpuTime);
+ 100 - 100 * average(result->server_stats(), ServerIdleCpuTime) /
+ average(result->server_stats(), ServerTotalCpuTime);
result->mutable_summary()->set_server_cpu_usage(server_cpu_usage);
}
diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h
index 3d04ee57da..e31d5d78a8 100644
--- a/test/cpp/qps/histogram.h
+++ b/test/cpp/qps/histogram.h
@@ -70,7 +70,7 @@ class Histogram {
gpr_histogram* impl_;
};
-}
-}
+} // namespace testing
+} // namespace grpc
#endif /* TEST_QPS_HISTOGRAM_H */
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index 1fa310c209..9c48066c9c 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -102,7 +102,7 @@ class InterarrivalTimer {
std::vector<time_table::const_iterator> thread_posns_;
time_table random_table_;
};
-}
-}
+} // namespace testing
+} // namespace grpc
#endif
diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc
index 343e073f3f..a98ae394db 100644
--- a/test/cpp/qps/parse_json.cc
+++ b/test/cpp/qps/parse_json.cc
@@ -61,5 +61,5 @@ grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg,
return json_string;
}
-} // testing
-} // grpc
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/parse_json.h b/test/cpp/qps/parse_json.h
index b320d26c1a..f2fffb52d4 100644
--- a/test/cpp/qps/parse_json.h
+++ b/test/cpp/qps/parse_json.h
@@ -31,7 +31,7 @@ void ParseJson(const grpc::string& json, const grpc::string& type,
grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg,
const grpc::string& type);
-} // testing
-} // grpc
+} // namespace testing
+} // namespace grpc
#endif // TEST_QPS_PARSE_JSON_H
diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc
index 87f09e8c5f..461bf624ce 100644
--- a/test/cpp/qps/qps_interarrival_test.cc
+++ b/test/cpp/qps/qps_interarrival_test.cc
@@ -25,13 +25,13 @@
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/util/test_config.h"
-using grpc::testing::RandomDistInterface;
using grpc::testing::InterarrivalTimer;
+using grpc::testing::RandomDistInterface;
-static void RunTest(RandomDistInterface &&r, int threads, std::string title) {
+static void RunTest(RandomDistInterface&& r, int threads, std::string title) {
InterarrivalTimer timer;
timer.init(r, threads);
- gpr_histogram *h(gpr_histogram_create(0.01, 60e9));
+ gpr_histogram* h(gpr_histogram_create(0.01, 60e9));
for (int i = 0; i < 10000000; i++) {
for (int j = 0; j < threads; j++) {
@@ -50,7 +50,7 @@ static void RunTest(RandomDistInterface &&r, int threads, std::string title) {
using grpc::testing::ExpDist;
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
RunTest(ExpDist(10.0), 5, std::string("Exponential(10)"));
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 1c1a5636a9..23c7e85283 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -48,30 +48,30 @@ template <class RequestType, class ResponseType, class ServiceType,
class AsyncQpsServerTest final : public grpc::testing::Server {
public:
AsyncQpsServerTest(
- const ServerConfig &config,
- std::function<void(ServerBuilder *, ServiceType *)> register_service,
- std::function<void(ServiceType *, ServerContextType *, RequestType *,
- ServerAsyncResponseWriter<ResponseType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ const ServerConfig& config,
+ std::function<void(ServerBuilder*, ServiceType*)> register_service,
+ std::function<void(ServiceType*, ServerContextType*, RequestType*,
+ ServerAsyncResponseWriter<ResponseType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_unary_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReaderWriter<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReaderWriter<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReader<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReader<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_from_client_function,
- std::function<void(ServiceType *, ServerContextType *, RequestType *,
- ServerAsyncWriter<ResponseType> *, CompletionQueue *,
- ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*, RequestType*,
+ ServerAsyncWriter<ResponseType>*, CompletionQueue*,
+ ServerCompletionQueue*, void*)>
request_streaming_from_server_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReaderWriter<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReaderWriter<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_both_ways_function,
- std::function<grpc::Status(const PayloadConfig &, RequestType *,
- ResponseType *)>
+ std::function<grpc::Status(const PayloadConfig&, RequestType*,
+ ResponseType*)>
process_rpc)
: Server(config) {
ServerBuilder builder;
@@ -79,7 +79,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
auto port_num = port();
// Negative port number means inproc server, so no listen port needed
if (port_num >= 0) {
- char *server_address = NULL;
+ char* server_address = NULL;
gpr_join_host_port(&server_address, "::", port_num);
builder.AddListeningPort(server_address,
Server::CreateServerCredentials(config));
@@ -171,7 +171,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
}
for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); ++cq) {
bool ok;
- void *got_tag;
+ void* got_tag;
while ((*cq)->Next(&got_tag, &ok))
;
}
@@ -187,7 +187,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
}
std::shared_ptr<Channel> InProcessChannel(
- const ChannelArguments &args) override {
+ const ChannelArguments& args) override {
return server_->InProcessChannel(args);
}
@@ -201,12 +201,12 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
void ThreadFunc(int thread_idx) {
// Wait until work is available or we are shutting down
bool ok;
- void *got_tag;
+ void* got_tag;
if (!srv_cqs_[cq_[thread_idx]]->Next(&got_tag, &ok)) {
return;
}
- ServerRpcContext *ctx;
- std::mutex *mu_ptr = &shutdown_state_[thread_idx]->mutex;
+ ServerRpcContext* ctx;
+ std::mutex* mu_ptr = &shutdown_state_[thread_idx]->mutex;
do {
ctx = detag(got_tag);
// The tag is a pointer to an RPC context to invoke
@@ -240,22 +240,21 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
private:
std::mutex mu_;
};
- static void *tag(ServerRpcContext *func) {
- return reinterpret_cast<void *>(func);
+ static void* tag(ServerRpcContext* func) {
+ return reinterpret_cast<void*>(func);
}
- static ServerRpcContext *detag(void *tag) {
- return reinterpret_cast<ServerRpcContext *>(tag);
+ static ServerRpcContext* detag(void* tag) {
+ return reinterpret_cast<ServerRpcContext*>(tag);
}
class ServerRpcContextUnaryImpl final : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *,
- void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*,
+ void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextUnaryImpl::invoker),
request_method_(request_method),
@@ -297,10 +296,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextUnaryImpl::*next_state_)(bool);
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
@@ -308,11 +307,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
public:
ServerRpcContextStreamingImpl(
std::function<void(
- ServerContextType *,
- grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
+ ServerContextType*,
+ grpc::ServerAsyncReaderWriter<ResponseType, RequestType>*, void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingImpl::request_done),
request_method_(request_method),
@@ -376,10 +374,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
ResponseType response_;
bool (ServerRpcContextStreamingImpl::*next_state_)(bool);
std::function<void(
- ServerContextType *,
- grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
+ ServerContextType*,
+ grpc::ServerAsyncReaderWriter<ResponseType, RequestType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncReaderWriter<ResponseType, RequestType> stream_;
};
@@ -387,12 +385,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
: public ServerRpcContext {
public:
ServerRpcContextStreamingFromClientImpl(
- std::function<void(ServerContextType *,
- grpc::ServerAsyncReader<ResponseType, RequestType> *,
- void *)>
+ std::function<void(ServerContextType*,
+ grpc::ServerAsyncReader<ResponseType, RequestType>*,
+ void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingFromClientImpl::request_done),
request_method_(request_method),
@@ -445,11 +442,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextStreamingFromClientImpl::*next_state_)(bool);
- std::function<void(ServerContextType *,
- grpc::ServerAsyncReader<ResponseType, RequestType> *,
- void *)>
+ std::function<void(ServerContextType*,
+ grpc::ServerAsyncReader<ResponseType, RequestType>*,
+ void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncReader<ResponseType, RequestType> stream_;
};
@@ -457,11 +454,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
: public ServerRpcContext {
public:
ServerRpcContextStreamingFromServerImpl(
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncWriter<ResponseType>*, void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingFromServerImpl::request_done),
request_method_(request_method),
@@ -514,10 +510,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextStreamingFromServerImpl::*next_state_)(bool);
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncWriter<ResponseType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncWriter<ResponseType> stream_;
};
@@ -537,17 +533,17 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
std::vector<std::unique_ptr<PerThreadShutdownState>> shutdown_state_;
};
-static void RegisterBenchmarkService(ServerBuilder *builder,
- BenchmarkService::AsyncService *service) {
+static void RegisterBenchmarkService(ServerBuilder* builder,
+ BenchmarkService::AsyncService* service) {
builder->RegisterService(service);
}
-static void RegisterGenericService(ServerBuilder *builder,
- grpc::AsyncGenericService *service) {
+static void RegisterGenericService(ServerBuilder* builder,
+ grpc::AsyncGenericService* service) {
builder->RegisterAsyncGenericService(service);
}
-static Status ProcessSimpleRPC(const PayloadConfig &, SimpleRequest *request,
- SimpleResponse *response) {
+static Status ProcessSimpleRPC(const PayloadConfig&, SimpleRequest* request,
+ SimpleResponse* response) {
if (request->response_size() > 0) {
if (!Server::SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
@@ -560,8 +556,8 @@ static Status ProcessSimpleRPC(const PayloadConfig &, SimpleRequest *request,
return Status::OK;
}
-static Status ProcessGenericRPC(const PayloadConfig &payload_config,
- ByteBuffer *request, ByteBuffer *response) {
+static Status ProcessGenericRPC(const PayloadConfig& payload_config,
+ ByteBuffer* request, ByteBuffer* response) {
// We are done using the request. Clear it to reduce working memory.
// This proves to reduce cache misses in large message size cases.
request->Clear();
@@ -572,7 +568,7 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
return Status::OK;
}
-std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
+std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config) {
return std::unique_ptr<Server>(
new AsyncQpsServerTest<SimpleRequest, SimpleResponse,
BenchmarkService::AsyncService,
@@ -585,7 +581,7 @@ std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
&BenchmarkService::AsyncService::RequestStreamingBothWays,
ProcessSimpleRPC));
}
-std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) {
+std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig& config) {
return std::unique_ptr<Server>(
new AsyncQpsServerTest<ByteBuffer, ByteBuffer, grpc::AsyncGenericService,
grpc::GenericServerContext>(