Merge remote-tracking branch 'upstream/master' into sync_async_mix

pull/4714/head
yang-g 9 years ago
commit b9a1377fab
  1. 4
      include/grpc++/generic/async_generic_service.h
  2. 4
      include/grpc++/support/byte_buffer.h
  3. 4
      include/grpc++/support/slice.h
  4. 4
      src/cpp/util/byte_buffer.cc
  5. 4
      test/cpp/qps/client.h
  6. 38
      test/cpp/qps/client_async.cc
  7. 4
      test/cpp/qps/client_sync.cc
  8. 4
      test/cpp/qps/generic_async_streaming_ping_pong_test.cc
  9. 4
      test/cpp/qps/qps_driver.cc
  10. 4
      test/cpp/qps/qps_worker.cc
  11. 4
      test/cpp/qps/server.h
  12. 24
      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
@ -76,4 +76,4 @@ class AsyncGenericService GRPC_FINAL {
} // namespace grpc
#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_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
@ -107,4 +107,4 @@ class SerializationTraits<ByteBuffer, void> {
} // namespace grpc
#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H
#endif // GRPCXX_SUPPORT_BYTE_BUFFER_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
@ -85,4 +85,4 @@ class Slice GRPC_FINAL {
} // namespace grpc
#endif // GRPCXX_SUPPORT_SLICE_H
#endif // GRPCXX_SUPPORT_SLICE_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
@ -88,4 +88,4 @@ ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
return *this;
}
} // namespace grpc
} // namespace grpc

@ -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

@ -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

@ -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

@ -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;
}
}

@ -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
@ -184,4 +184,4 @@ int main(int argc, char** argv) {
grpc::testing::QpsDriver();
return 0;
}
}

@ -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

@ -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

@ -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;
@ -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),
@ -383,14 +381,12 @@ 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>(
@ -401,4 +397,4 @@ std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) {
}
} // namespace testing
} // namespace grpc
} // namespace grpc
Loading…
Cancel
Save