From baa14a975ef92ee6fb301f0e684f56f18f2c55a7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 3 Nov 2017 09:09:36 -0700 Subject: Update clang-format to 5.0 --- test/cpp/qps/client_async.cc | 2 +- test/cpp/qps/driver.cc | 7 +- test/cpp/qps/histogram.h | 4 +- test/cpp/qps/interarrival.h | 4 +- test/cpp/qps/parse_json.cc | 4 +- test/cpp/qps/parse_json.h | 4 +- test/cpp/qps/qps_interarrival_test.cc | 8 +- test/cpp/qps/server_async.cc | 136 +++++++++++++++++----------------- 8 files changed, 82 insertions(+), 87 deletions(-) (limited to 'test/cpp/qps') 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 { // 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::cores_; using ClientImpl::channels_; using ClientImpl::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 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 register_service, - std::function *, - CompletionQueue *, ServerCompletionQueue *, void *)> + const ServerConfig& config, + std::function register_service, + std::function*, + CompletionQueue*, ServerCompletionQueue*, void*)> request_unary_function, - std::function *, - CompletionQueue *, ServerCompletionQueue *, void *)> + std::function*, + CompletionQueue*, ServerCompletionQueue*, void*)> request_streaming_function, - std::function *, - CompletionQueue *, ServerCompletionQueue *, void *)> + std::function*, + CompletionQueue*, ServerCompletionQueue*, void*)> request_streaming_from_client_function, - std::function *, CompletionQueue *, - ServerCompletionQueue *, void *)> + std::function*, CompletionQueue*, + ServerCompletionQueue*, void*)> request_streaming_from_server_function, - std::function *, - CompletionQueue *, ServerCompletionQueue *, void *)> + std::function*, + CompletionQueue*, ServerCompletionQueue*, void*)> request_streaming_both_ways_function, - std::function + std::function 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 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(func); + static void* tag(ServerRpcContext* func) { + return reinterpret_cast(func); } - static ServerRpcContext *detag(void *tag) { - return reinterpret_cast(tag); + static ServerRpcContext* detag(void* tag) { + return reinterpret_cast(tag); } class ServerRpcContextUnaryImpl final : public ServerRpcContext { public: ServerRpcContextUnaryImpl( - std::function *, - void *)> + std::function*, + void*)> request_method, - std::function - invoke_method) + std::function 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 *)> + std::function*, void*)> request_method_; - std::function invoke_method_; + std::function invoke_method_; grpc::ServerAsyncResponseWriter response_writer_; }; @@ -308,11 +307,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server { public: ServerRpcContextStreamingImpl( std::function *, void *)> + ServerContextType*, + grpc::ServerAsyncReaderWriter*, void*)> request_method, - std::function - invoke_method) + std::function 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*, void*)> request_method_; - std::function invoke_method_; + std::function invoke_method_; grpc::ServerAsyncReaderWriter stream_; }; @@ -387,12 +385,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server { : public ServerRpcContext { public: ServerRpcContextStreamingFromClientImpl( - std::function *, - void *)> + std::function*, + void*)> request_method, - std::function - invoke_method) + std::function 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 *)> + std::function*, + void*)> request_method_; - std::function invoke_method_; + std::function invoke_method_; grpc::ServerAsyncReader stream_; }; @@ -457,11 +454,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server { : public ServerRpcContext { public: ServerRpcContextStreamingFromServerImpl( - std::function *, void *)> + std::function*, void*)> request_method, - std::function - invoke_method) + std::function 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 *)> + std::function*, void*)> request_method_; - std::function invoke_method_; + std::function invoke_method_; grpc::ServerAsyncWriter stream_; }; @@ -537,17 +533,17 @@ class AsyncQpsServerTest final : public grpc::testing::Server { std::vector> 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 CreateAsyncServer(const ServerConfig &config) { +std::unique_ptr CreateAsyncServer(const ServerConfig& config) { return std::unique_ptr( new AsyncQpsServerTest CreateAsyncServer(const ServerConfig &config) { &BenchmarkService::AsyncService::RequestStreamingBothWays, ProcessSimpleRPC)); } -std::unique_ptr CreateAsyncGenericServer(const ServerConfig &config) { +std::unique_ptr CreateAsyncGenericServer(const ServerConfig& config) { return std::unique_ptr( new AsyncQpsServerTest( -- cgit v1.2.3