diff options
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/qps/client.h | 4 | ||||
-rw-r--r-- | test/cpp/qps/client_async.cc | 38 | ||||
-rw-r--r-- | test/cpp/qps/client_sync.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/generic_async_streaming_ping_pong_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/qps_driver.cc | 8 | ||||
-rw-r--r-- | test/cpp/qps/qps_worker.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/server.h | 4 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 36 |
8 files changed, 45 insertions, 57 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 03bbf03b6c..0159f4f1e6 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -377,4 +377,4 @@ std::unique_ptr<Client> CreateGenericAsyncStreamingClient( } // namespace testing } // namespace grpc -#endif +#endif
\ No newline at end of file diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index af55187b2b..3e2317c6d4 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,8 +93,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function< std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req, + CompletionQueue*)> start_req, std::function<void(grpc::Status, ResponseType*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -140,8 +139,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function<void(grpc::Status, ResponseType*)> callback_; std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req_; + CompletionQueue*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> @@ -160,12 +158,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { using Client::closed_loop_; using ClientImpl<StubType, RequestType>::channels_; using ClientImpl<StubType, RequestType>::request_; - AsyncClient( - const ClientConfig& config, - std::function<ClientRpcContext*(int, StubType*, const RequestType&)> - setup_ctx, - std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> - create_stub) + AsyncClient(const ClientConfig& config, + std::function<ClientRpcContext*(int, StubType*, + const RequestType&)> setup_ctx, + std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> + create_stub) : ClientImpl<StubType, RequestType>(config, create_stub), channel_lock_(new std::mutex[config.client_channels()]), contexts_(config.client_channels()), @@ -394,8 +391,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { std::function<std::unique_ptr< grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> - start_req, + void*)> start_req, std::function<void(grpc::Status, ResponseType*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -447,10 +443,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { ResponseType response_; bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); std::function<void(grpc::Status, ResponseType*)> callback_; - std::function<std::unique_ptr< - grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> - start_req_; + std::function< + std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, + void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> @@ -494,8 +490,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, - const grpc::string& method_name, CompletionQueue*, void*)> - start_req, + const grpc::string& method_name, CompletionQueue*, void*)> start_req, std::function<void(grpc::Status, ByteBuffer*)> on_done) : ClientRpcContext(channel_id), context_(), @@ -552,8 +547,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function<void(grpc::Status, ByteBuffer*)> callback_; std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> - start_req_; + CompletionQueue*, void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; @@ -605,4 +599,4 @@ std::unique_ptr<Client> CreateGenericAsyncStreamingClient( } } // namespace testing -} // namespace grpc +} // namespace grpc
\ No newline at end of file diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 54cdf390d7..1045915b83 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -172,4 +172,4 @@ std::unique_ptr<Client> CreateSynchronousStreamingClient( } } // namespace testing -} // namespace grpc +} // namespace grpc
\ No newline at end of file diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc index fe79b2d803..7a1275054a 100644 --- a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,4 +79,4 @@ int main(int argc, char** argv) { grpc::testing::RunGenericAsyncStreamingPingPong(); return 0; -} +}
\ No newline at end of file diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index a8d404590c..c70db188d9 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,11 +113,11 @@ static void QpsDriver() { } } else if (FLAGS_bbuf_resp_size >= 0) { auto params = - client_config.mutable_payload_config()->mutable_bytebuf_params(); + client_config.mutable_payload_config()->mutable_bytebuf_params(); params->set_resp_size(FLAGS_bbuf_resp_size); if (FLAGS_bbuf_req_size >= 0) { params->set_req_size(FLAGS_bbuf_req_size); - } + } } else { // set a reasonable default: proto but no payload client_config.mutable_payload_config()->mutable_simple_params(); @@ -184,4 +184,4 @@ int main(int argc, char** argv) { grpc::testing::QpsDriver(); return 0; -} +}
\ No newline at end of file diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index ef2b633f68..e7714c0bb3 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -239,4 +239,4 @@ QpsWorker::QpsWorker(int driver_port) { QpsWorker::~QpsWorker() {} } // namespace testing -} // namespace grpc +} // namespace grpc
\ No newline at end of file diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 920fc56356..daee7c3663 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,4 +112,4 @@ std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config); } // namespace testing } // namespace grpc -#endif +#endif
\ No newline at end of file diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index b39d8c4d3e..1ae88d7323 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,8 +72,7 @@ class AsyncQpsServerTest : public Server { CompletionQueue *, ServerCompletionQueue *, void *)> request_streaming_function, std::function<grpc::Status(const PayloadConfig &, const RequestType *, - ResponseType *)> - process_rpc) + ResponseType *)> process_rpc) : Server(config) { char *server_address = NULL; @@ -94,8 +93,8 @@ class AsyncQpsServerTest : public Server { using namespace std::placeholders; - auto process_rpc_bound = std::bind(process_rpc, config.payload_config(), - _1, _2); + auto process_rpc_bound = + std::bind(process_rpc, config.payload_config(), _1, _2); for (int i = 0; i < 10000 / config.async_server_threads(); i++) { for (int j = 0; j < config.async_server_threads(); j++) { @@ -185,8 +184,7 @@ class AsyncQpsServerTest : public Server { ServerRpcContextUnaryImpl( std::function<void(ServerContextType *, RequestType *, grpc::ServerAsyncResponseWriter<ResponseType> *, - void *)> - request_method, + void *)> request_method, std::function<grpc::Status(const RequestType *, ResponseType *)> invoke_method) : srv_ctx_(new ServerContextType), @@ -359,8 +357,7 @@ static void RegisterGenericService(ServerBuilder *builder, builder->RegisterAsyncGenericService(service); } - -static Status ProcessSimpleRPC(const PayloadConfig&, +static Status ProcessSimpleRPC(const PayloadConfig &, const SimpleRequest *request, SimpleResponse *response) { if (request->response_size() > 0) { @@ -372,7 +369,7 @@ static Status ProcessSimpleRPC(const PayloadConfig&, return Status::OK; } -static Status ProcessGenericRPC(const PayloadConfig& payload_config, +static Status ProcessGenericRPC(const PayloadConfig &payload_config, const ByteBuffer *request, ByteBuffer *response) { int resp_size = payload_config.bytebuf_params().resp_size(); @@ -384,23 +381,20 @@ static Status ProcessGenericRPC(const PayloadConfig& payload_config, } std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) { - return std::unique_ptr<Server>( - new AsyncQpsServerTest<SimpleRequest, SimpleResponse, - BenchmarkService::AsyncService, - grpc::ServerContext>( - config, RegisterBenchmarkService, - &BenchmarkService::AsyncService::RequestUnaryCall, - &BenchmarkService::AsyncService::RequestStreamingCall, - ProcessSimpleRPC)); + return std::unique_ptr<Server>(new AsyncQpsServerTest< + SimpleRequest, SimpleResponse, BenchmarkService::AsyncService, + grpc::ServerContext>( + config, RegisterBenchmarkService, + &BenchmarkService::AsyncService::RequestUnaryCall, + &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC)); } std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) { return std::unique_ptr<Server>( new AsyncQpsServerTest<ByteBuffer, ByteBuffer, grpc::AsyncGenericService, grpc::GenericServerContext>( config, RegisterGenericService, nullptr, - &grpc::AsyncGenericService::RequestCall, - ProcessGenericRPC)); + &grpc::AsyncGenericService::RequestCall, ProcessGenericRPC)); } } // namespace testing -} // namespace grpc +} // namespace grpc
\ No newline at end of file |