vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2015, Google Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #include <cassert> |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 35 | #include <forward_list> |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 36 | #include <functional> |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 37 | #include <list> |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 38 | #include <memory> |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 39 | #include <mutex> |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 40 | #include <string> |
| 41 | #include <thread> |
| 42 | #include <vector> |
| 43 | #include <sstream> |
| 44 | |
| 45 | #include <grpc/grpc.h> |
| 46 | #include <grpc/support/histogram.h> |
| 47 | #include <grpc/support/log.h> |
| 48 | #include <gflags/gflags.h> |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 49 | #include <grpc++/client_context.h> |
yang-g | 9e2f90c | 2015-08-21 15:35:03 -0700 | [diff] [blame] | 50 | |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 51 | #include "test/cpp/qps/timer.h" |
| 52 | #include "test/cpp/qps/client.h" |
yang-g | 9e2f90c | 2015-08-21 15:35:03 -0700 | [diff] [blame] | 53 | #include "test/cpp/util/create_test_channel.h" |
vjpai | d08a738 | 2015-11-02 16:45:08 -0800 | [diff] [blame] | 54 | #include "test/proto/benchmarks/services.grpc.pb.h" |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 55 | |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 56 | namespace grpc { |
| 57 | namespace testing { |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 58 | |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 59 | typedef std::list<grpc_time> deadline_list; |
| 60 | |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 61 | class ClientRpcContext { |
| 62 | public: |
Yang Gao | b6d57e7 | 2015-06-09 22:11:12 -0700 | [diff] [blame] | 63 | explicit ClientRpcContext(int ch) : channel_id_(ch) {} |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 64 | virtual ~ClientRpcContext() {} |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 65 | // next state, return false if done. Collect stats when appropriate |
Vijay Pai | 1da729a | 2015-03-23 12:52:56 -0700 | [diff] [blame] | 66 | virtual bool RunNextState(bool, Histogram* hist) = 0; |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 67 | virtual ClientRpcContext* StartNewClone() = 0; |
Yang Gao | 6baa9b6 | 2015-03-17 10:49:39 -0700 | [diff] [blame] | 68 | static void* tag(ClientRpcContext* c) { return reinterpret_cast<void*>(c); } |
| 69 | static ClientRpcContext* detag(void* t) { |
| 70 | return reinterpret_cast<ClientRpcContext*>(t); |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 71 | } |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 72 | |
| 73 | deadline_list::iterator deadline_posn() const { return deadline_posn_; } |
| 74 | void set_deadline_posn(const deadline_list::iterator& it) { |
| 75 | deadline_posn_ = it; |
| 76 | } |
| 77 | virtual void Start(CompletionQueue* cq) = 0; |
| 78 | int channel_id() const { return channel_id_; } |
| 79 | |
| 80 | protected: |
| 81 | int channel_id_; |
| 82 | |
| 83 | private: |
| 84 | deadline_list::iterator deadline_posn_; |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 85 | }; |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 86 | |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 87 | template <class RequestType, class ResponseType> |
| 88 | class ClientRpcContextUnaryImpl : public ClientRpcContext { |
| 89 | public: |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 90 | ClientRpcContextUnaryImpl( |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 91 | int channel_id, BenchmarkService::Stub* stub, const RequestType& req, |
vjpai | 4e1e1bc | 2015-02-27 23:47:12 -0800 | [diff] [blame] | 92 | std::function< |
| 93 | std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 94 | BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 95 | CompletionQueue*)> start_req, |
Yang Gao | 6baa9b6 | 2015-03-17 10:49:39 -0700 | [diff] [blame] | 96 | std::function<void(grpc::Status, ResponseType*)> on_done) |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 97 | : ClientRpcContext(channel_id), |
| 98 | context_(), |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 99 | stub_(stub), |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 100 | req_(req), |
| 101 | response_(), |
Craig Tiller | 3676b38 | 2015-05-06 13:01:05 -0700 | [diff] [blame] | 102 | next_state_(&ClientRpcContextUnaryImpl::RespDone), |
Craig Tiller | a182bf1 | 2015-03-04 13:54:39 -0800 | [diff] [blame] | 103 | callback_(on_done), |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 104 | start_req_(start_req) {} |
| 105 | void Start(CompletionQueue* cq) GRPC_OVERRIDE { |
| 106 | start_ = Timer::Now(); |
| 107 | response_reader_ = start_req_(stub_, &context_, req_, cq); |
Craig Tiller | 3676b38 | 2015-05-06 13:01:05 -0700 | [diff] [blame] | 108 | response_reader_->Finish(&response_, &status_, ClientRpcContext::tag(this)); |
| 109 | } |
vjpai | 3c11066 | 2015-02-27 07:17:16 -0800 | [diff] [blame] | 110 | ~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {} |
Vijay Pai | 1da729a | 2015-03-23 12:52:56 -0700 | [diff] [blame] | 111 | bool RunNextState(bool ok, Histogram* hist) GRPC_OVERRIDE { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 112 | bool ret = (this->*next_state_)(ok); |
| 113 | if (!ret) { |
| 114 | hist->Add((Timer::Now() - start_) * 1e9); |
| 115 | } |
| 116 | return ret; |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 117 | } |
| 118 | |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 119 | ClientRpcContext* StartNewClone() GRPC_OVERRIDE { |
| 120 | return new ClientRpcContextUnaryImpl(channel_id_, stub_, req_, start_req_, |
| 121 | callback_); |
Craig Tiller | ef63839 | 2015-03-04 12:23:12 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 124 | private: |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 125 | bool RespDone(bool) { |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 126 | next_state_ = &ClientRpcContextUnaryImpl::DoCallBack; |
| 127 | return false; |
| 128 | } |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 129 | bool DoCallBack(bool) { |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 130 | callback_(status_, &response_); |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 131 | return true; // we're done, this'll be ignored |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 132 | } |
| 133 | grpc::ClientContext context_; |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 134 | BenchmarkService::Stub* stub_; |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 135 | RequestType req_; |
| 136 | ResponseType response_; |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 137 | bool (ClientRpcContextUnaryImpl::*next_state_)(bool); |
Yang Gao | 6baa9b6 | 2015-03-17 10:49:39 -0700 | [diff] [blame] | 138 | std::function<void(grpc::Status, ResponseType*)> callback_; |
Craig Tiller | a182bf1 | 2015-03-04 13:54:39 -0800 | [diff] [blame] | 139 | std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 140 | BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 141 | CompletionQueue*)> start_req_; |
Vijay Pai | 64ac47f | 2015-02-26 17:59:51 -0800 | [diff] [blame] | 142 | grpc::Status status_; |
| 143 | double start_; |
| 144 | std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> |
| 145 | response_reader_; |
| 146 | }; |
vjpai | dea740f | 2015-02-26 16:35:35 -0800 | [diff] [blame] | 147 | |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 148 | typedef std::forward_list<ClientRpcContext*> context_list; |
| 149 | |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 150 | template <class StubType, class RequestType> |
| 151 | class AsyncClient : public Client<StubType, RequestType> { |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 152 | public: |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 153 | AsyncClient( |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 154 | const ClientConfig& config, |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 155 | std::function<ClientRpcContext*(int, StubType*, const RequestType&)> setup_ctx, |
| 156 | std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> create_stub) |
| 157 | : Client(config, create_stub), |
Vijay Pai | 90e7369 | 2015-08-05 19:15:36 -0700 | [diff] [blame] | 158 | channel_lock_(new std::mutex[config.client_channels()]), |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 159 | contexts_(config.client_channels()), |
| 160 | max_outstanding_per_channel_(config.outstanding_rpcs_per_channel()), |
| 161 | channel_count_(config.client_channels()), |
| 162 | pref_channel_inc_(config.async_client_threads()) { |
| 163 | SetupLoadTest(config, config.async_client_threads()); |
| 164 | |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 165 | for (int i = 0; i < config.async_client_threads(); i++) { |
| 166 | cli_cqs_.emplace_back(new CompletionQueue); |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 167 | if (!closed_loop_) { |
| 168 | rpc_deadlines_.emplace_back(); |
| 169 | next_channel_.push_back(i % channel_count_); |
Vijay Pai | e2980cd | 2015-07-01 09:38:20 -0700 | [diff] [blame] | 170 | issue_allowed_.emplace_back(true); |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 171 | |
| 172 | grpc_time next_issue; |
| 173 | NextIssueTime(i, &next_issue); |
| 174 | next_issue_.push_back(next_issue); |
| 175 | } |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 176 | } |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 177 | |
vjpai | 6a60802 | 2015-05-18 09:16:53 -0700 | [diff] [blame] | 178 | int t = 0; |
| 179 | for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 180 | for (int ch = 0; ch < channel_count_; ch++) { |
Vijay Pai | 7b172b2 | 2015-06-05 02:03:18 -0700 | [diff] [blame] | 181 | auto* cq = cli_cqs_[t].get(); |
| 182 | t = (t + 1) % cli_cqs_.size(); |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 183 | auto ctx = setup_ctx(ch, channels_[ch].get_stub(), request_); |
| 184 | if (closed_loop_) { |
| 185 | ctx->Start(cq); |
| 186 | } else { |
| 187 | contexts_[ch].push_front(ctx); |
| 188 | } |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 189 | } |
| 190 | } |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 191 | } |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 192 | virtual ~AsyncClient() { |
Vijay Pai | 82dd80a | 2015-03-24 10:36:08 -0700 | [diff] [blame] | 193 | for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { |
| 194 | (*cq)->Shutdown(); |
Yang Gao | 6baa9b6 | 2015-03-17 10:49:39 -0700 | [diff] [blame] | 195 | void* got_tag; |
Craig Tiller | ef63839 | 2015-03-04 12:23:12 -0800 | [diff] [blame] | 196 | bool ok; |
Vijay Pai | 82dd80a | 2015-03-24 10:36:08 -0700 | [diff] [blame] | 197 | while ((*cq)->Next(&got_tag, &ok)) { |
Craig Tiller | ef63839 | 2015-03-04 12:23:12 -0800 | [diff] [blame] | 198 | delete ClientRpcContext::detag(got_tag); |
| 199 | } |
| 200 | } |
Vijay Pai | 5606199 | 2015-07-01 13:39:48 -0700 | [diff] [blame] | 201 | // Now clear out all the pre-allocated idle contexts |
| 202 | for (int ch = 0; ch < channel_count_; ch++) { |
Vijay Pai | 13735d5 | 2015-07-01 14:00:08 -0700 | [diff] [blame] | 203 | while (!contexts_[ch].empty()) { |
Vijay Pai | 5606199 | 2015-07-01 13:39:48 -0700 | [diff] [blame] | 204 | // Get an idle context from the front of the list |
| 205 | auto* ctx = *(contexts_[ch].begin()); |
| 206 | contexts_[ch].pop_front(); |
| 207 | delete ctx; |
| 208 | } |
| 209 | } |
Vijay Pai | eed63fa | 2015-08-05 23:08:34 +0000 | [diff] [blame] | 210 | delete[] channel_lock_; |
Craig Tiller | ef63839 | 2015-03-04 12:23:12 -0800 | [diff] [blame] | 211 | } |
| 212 | |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 213 | bool ThreadFunc(Histogram* histogram, |
| 214 | size_t thread_idx) GRPC_OVERRIDE GRPC_FINAL { |
Yang Gao | 6baa9b6 | 2015-03-17 10:49:39 -0700 | [diff] [blame] | 215 | void* got_tag; |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 216 | bool ok; |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 217 | grpc_time deadline, short_deadline; |
| 218 | if (closed_loop_) { |
| 219 | deadline = grpc_time_source::now() + std::chrono::seconds(1); |
| 220 | short_deadline = deadline; |
| 221 | } else { |
| 222 | if (rpc_deadlines_[thread_idx].empty()) { |
| 223 | deadline = grpc_time_source::now() + std::chrono::seconds(1); |
| 224 | } else { |
| 225 | deadline = *(rpc_deadlines_[thread_idx].begin()); |
| 226 | } |
| 227 | short_deadline = |
| 228 | issue_allowed_[thread_idx] ? next_issue_[thread_idx] : deadline; |
| 229 | } |
| 230 | |
| 231 | bool got_event; |
| 232 | |
| 233 | switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, short_deadline)) { |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 234 | case CompletionQueue::SHUTDOWN: |
| 235 | return false; |
vjpai | 37f7257 | 2015-05-12 10:29:07 -0700 | [diff] [blame] | 236 | case CompletionQueue::TIMEOUT: |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 237 | got_event = false; |
| 238 | break; |
vjpai | 37f7257 | 2015-05-12 10:29:07 -0700 | [diff] [blame] | 239 | case CompletionQueue::GOT_EVENT: |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 240 | got_event = true; |
| 241 | break; |
| 242 | default: |
| 243 | GPR_ASSERT(false); |
Vijay Pai | 9dc5c15 | 2015-06-03 11:34:53 -0700 | [diff] [blame] | 244 | break; |
Craig Tiller | 1c61af7 | 2015-04-09 12:08:44 -0700 | [diff] [blame] | 245 | } |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 246 | if (got_event) { |
| 247 | ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); |
| 248 | if (ctx->RunNextState(ok, histogram) == false) { |
| 249 | // call the callback and then clone the ctx |
| 250 | ctx->RunNextState(ok, histogram); |
| 251 | ClientRpcContext* clone_ctx = ctx->StartNewClone(); |
| 252 | if (closed_loop_) { |
| 253 | clone_ctx->Start(cli_cqs_[thread_idx].get()); |
| 254 | } else { |
| 255 | // Remove the entry from the rpc deadlines list |
| 256 | rpc_deadlines_[thread_idx].erase(ctx->deadline_posn()); |
| 257 | // Put the clone_ctx in the list of idle contexts for this channel |
| 258 | // Under lock |
| 259 | int ch = clone_ctx->channel_id(); |
| 260 | std::lock_guard<std::mutex> g(channel_lock_[ch]); |
| 261 | contexts_[ch].push_front(clone_ctx); |
| 262 | } |
| 263 | // delete the old version |
| 264 | delete ctx; |
| 265 | } |
| 266 | if (!closed_loop_) |
| 267 | issue_allowed_[thread_idx] = |
| 268 | true; // may be ok now even if it hadn't been |
| 269 | } |
| 270 | if (!closed_loop_ && issue_allowed_[thread_idx] && |
| 271 | grpc_time_source::now() >= next_issue_[thread_idx]) { |
| 272 | // Attempt to issue |
| 273 | bool issued = false; |
| 274 | for (int num_attempts = 0, channel_attempt = next_channel_[thread_idx]; |
| 275 | num_attempts < channel_count_ && !issued; num_attempts++) { |
| 276 | bool can_issue = false; |
| 277 | ClientRpcContext* ctx = nullptr; |
| 278 | { |
| 279 | std::lock_guard<std::mutex> g(channel_lock_[channel_attempt]); |
| 280 | if (!contexts_[channel_attempt].empty()) { |
| 281 | // Get an idle context from the front of the list |
| 282 | ctx = *(contexts_[channel_attempt].begin()); |
| 283 | contexts_[channel_attempt].pop_front(); |
| 284 | can_issue = true; |
| 285 | } |
| 286 | } |
| 287 | if (can_issue) { |
| 288 | // do the work to issue |
| 289 | rpc_deadlines_[thread_idx].emplace_back(grpc_time_source::now() + |
| 290 | std::chrono::seconds(1)); |
| 291 | auto it = rpc_deadlines_[thread_idx].end(); |
| 292 | --it; |
| 293 | ctx->set_deadline_posn(it); |
| 294 | ctx->Start(cli_cqs_[thread_idx].get()); |
| 295 | issued = true; |
| 296 | // If we did issue, then next time, try our thread's next |
| 297 | // preferred channel |
| 298 | next_channel_[thread_idx] += pref_channel_inc_; |
| 299 | if (next_channel_[thread_idx] >= channel_count_) |
| 300 | next_channel_[thread_idx] = (thread_idx % channel_count_); |
| 301 | } else { |
| 302 | // Do a modular increment of channel attempt if we couldn't issue |
| 303 | channel_attempt = (channel_attempt + 1) % channel_count_; |
| 304 | } |
| 305 | } |
| 306 | if (issued) { |
| 307 | // We issued one; see when we can issue the next |
| 308 | grpc_time next_issue; |
| 309 | NextIssueTime(thread_idx, &next_issue); |
| 310 | next_issue_[thread_idx] = next_issue; |
| 311 | } else { |
| 312 | issue_allowed_[thread_idx] = false; |
| 313 | } |
| 314 | } |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 315 | return true; |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 316 | } |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 317 | |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 318 | private: |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 319 | class boolean { // exists only to avoid data-race on vector<bool> |
Vijay Pai | e2980cd | 2015-07-01 09:38:20 -0700 | [diff] [blame] | 320 | public: |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 321 | boolean() : val_(false) {} |
| 322 | boolean(bool b) : val_(b) {} |
| 323 | operator bool() const { return val_; } |
| 324 | boolean& operator=(bool b) { |
| 325 | val_ = b; |
| 326 | return *this; |
| 327 | } |
| 328 | |
Vijay Pai | e2980cd | 2015-07-01 09:38:20 -0700 | [diff] [blame] | 329 | private: |
| 330 | bool val_; |
| 331 | }; |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 332 | std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_; |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 333 | |
| 334 | std::vector<deadline_list> rpc_deadlines_; // per thread deadlines |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 335 | std::vector<int> next_channel_; // per thread round-robin channel ctr |
| 336 | std::vector<boolean> issue_allowed_; // may this thread attempt to issue |
| 337 | std::vector<grpc_time> next_issue_; // when should it issue? |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 338 | |
Vijay Pai | 90e7369 | 2015-08-05 19:15:36 -0700 | [diff] [blame] | 339 | std::mutex* |
| 340 | channel_lock_; // a vector, but avoid std::vector for old compilers |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 341 | std::vector<context_list> contexts_; // per-channel list of idle contexts |
| 342 | int max_outstanding_per_channel_; |
| 343 | int channel_count_; |
| 344 | int pref_channel_inc_; |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 345 | }; |
| 346 | |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 347 | class AsyncUnaryClient GRPC_FINAL : public AsyncClient<BenchmarkService::Stub, SimpleRequest> { |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 348 | public: |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 349 | explicit AsyncUnaryClient(const ClientConfig& config) |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 350 | : AsyncClient(config, SetupCtx, BenchmarkService::NewStub) { |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 351 | StartThreads(config.async_client_threads()); |
| 352 | } |
| 353 | ~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); } |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 354 | |
| 355 | private: |
vjpai | 09d0b0c | 2015-07-31 08:39:54 -0700 | [diff] [blame] | 356 | static void CheckDone(grpc::Status s, SimpleResponse* response) {} |
| 357 | static std::unique_ptr<grpc::ClientAsyncResponseReader<SimpleResponse>> |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 358 | StartReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx, |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 359 | const SimpleRequest& request, CompletionQueue* cq) { |
vjpai | 09d0b0c | 2015-07-31 08:39:54 -0700 | [diff] [blame] | 360 | return stub->AsyncUnaryCall(ctx, request, cq); |
| 361 | }; |
Vijay Pai | ce84670 | 2015-11-04 00:30:12 -0800 | [diff] [blame] | 362 | static ClientRpcContext* SetupCtx(int channel_id, |
| 363 | BenchmarkService::Stub* stub, |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 364 | const SimpleRequest& req) { |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 365 | return new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>( |
| 366 | channel_id, stub, req, AsyncUnaryClient::StartReq, |
| 367 | AsyncUnaryClient::CheckDone); |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 368 | } |
| 369 | }; |
| 370 | |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 371 | template <class RequestType, class ResponseType> |
| 372 | class ClientRpcContextStreamingImpl : public ClientRpcContext { |
| 373 | public: |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 374 | ClientRpcContextStreamingImpl( |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 375 | int channel_id, BenchmarkService::Stub* stub, const RequestType& req, |
Vijay Pai | ce84670 | 2015-11-04 00:30:12 -0800 | [diff] [blame] | 376 | std::function<std::unique_ptr< |
| 377 | grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( |
| 378 | BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, |
| 379 | void*)> start_req, |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 380 | std::function<void(grpc::Status, ResponseType*)> on_done) |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 381 | : ClientRpcContext(channel_id), |
| 382 | context_(), |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 383 | stub_(stub), |
| 384 | req_(req), |
| 385 | response_(), |
| 386 | next_state_(&ClientRpcContextStreamingImpl::ReqSent), |
| 387 | callback_(on_done), |
| 388 | start_req_(start_req), |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 389 | start_(Timer::Now()) {} |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 390 | ~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {} |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 391 | bool RunNextState(bool ok, Histogram* hist) GRPC_OVERRIDE { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 392 | return (this->*next_state_)(ok, hist); |
| 393 | } |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 394 | ClientRpcContext* StartNewClone() GRPC_OVERRIDE { |
| 395 | return new ClientRpcContextStreamingImpl(channel_id_, stub_, req_, |
| 396 | start_req_, callback_); |
| 397 | } |
| 398 | void Start(CompletionQueue* cq) GRPC_OVERRIDE { |
| 399 | stream_ = start_req_(stub_, &context_, cq, ClientRpcContext::tag(this)); |
Vijay Pai | 7b172b2 | 2015-06-05 02:03:18 -0700 | [diff] [blame] | 400 | } |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 401 | |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 402 | private: |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 403 | bool ReqSent(bool ok, Histogram*) { return StartWrite(ok); } |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 404 | bool StartWrite(bool ok) { |
| 405 | if (!ok) { |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 406 | return (false); |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 407 | } |
| 408 | start_ = Timer::Now(); |
| 409 | next_state_ = &ClientRpcContextStreamingImpl::WriteDone; |
| 410 | stream_->Write(req_, ClientRpcContext::tag(this)); |
| 411 | return true; |
| 412 | } |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 413 | bool WriteDone(bool ok, Histogram*) { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 414 | if (!ok) { |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 415 | return (false); |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 416 | } |
| 417 | next_state_ = &ClientRpcContextStreamingImpl::ReadDone; |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 418 | stream_->Read(&response_, ClientRpcContext::tag(this)); |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 419 | return true; |
| 420 | } |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 421 | bool ReadDone(bool ok, Histogram* hist) { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 422 | hist->Add((Timer::Now() - start_) * 1e9); |
| 423 | return StartWrite(ok); |
| 424 | } |
| 425 | grpc::ClientContext context_; |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 426 | BenchmarkService::Stub* stub_; |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 427 | RequestType req_; |
| 428 | ResponseType response_; |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 429 | bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); |
| 430 | std::function<void(grpc::Status, ResponseType*)> callback_; |
| 431 | std::function< |
| 432 | std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( |
Vijay Pai | ce84670 | 2015-11-04 00:30:12 -0800 | [diff] [blame] | 433 | BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, |
| 434 | void*)> start_req_; |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 435 | grpc::Status status_; |
| 436 | double start_; |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 437 | std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> |
| 438 | stream_; |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 441 | class AsyncStreamingClient GRPC_FINAL : public AsyncClient<BenchmarkService::Stub, SimpleRequest> { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 442 | public: |
Craig Tiller | 5c8737d | 2015-05-21 11:42:17 -0700 | [diff] [blame] | 443 | explicit AsyncStreamingClient(const ClientConfig& config) |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 444 | : AsyncClient(config, SetupCtx, BenchmarkService::NewStub) { |
vjpai | 754751e | 2015-10-28 09:16:22 -0700 | [diff] [blame] | 445 | // async streaming currently only supports closed loop |
| 446 | GPR_ASSERT(closed_loop_); |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 447 | |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 448 | StartThreads(config.async_client_threads()); |
| 449 | } |
| 450 | |
Vijay Pai | e10ebf15 | 2015-04-30 13:12:31 -0700 | [diff] [blame] | 451 | ~AsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); } |
Vijay Pai | cf3fb09 | 2015-06-05 03:41:30 -0700 | [diff] [blame] | 452 | |
| 453 | private: |
vjpai | 09d0b0c | 2015-07-31 08:39:54 -0700 | [diff] [blame] | 454 | static void CheckDone(grpc::Status s, SimpleResponse* response) {} |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 455 | static std::unique_ptr< |
| 456 | grpc::ClientAsyncReaderWriter<SimpleRequest, SimpleResponse>> |
vjpai | 119c103 | 2015-10-29 01:21:04 -0700 | [diff] [blame] | 457 | StartReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx, |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 458 | CompletionQueue* cq, void* tag) { |
vjpai | 09d0b0c | 2015-07-31 08:39:54 -0700 | [diff] [blame] | 459 | auto stream = stub->AsyncStreamingCall(ctx, cq, tag); |
| 460 | return stream; |
| 461 | }; |
Vijay Pai | ce84670 | 2015-11-04 00:30:12 -0800 | [diff] [blame] | 462 | static ClientRpcContext* SetupCtx(int channel_id, |
| 463 | BenchmarkService::Stub* stub, |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 464 | const SimpleRequest& req) { |
Vijay Pai | 372fd87 | 2015-06-08 13:30:08 -0700 | [diff] [blame] | 465 | return new ClientRpcContextStreamingImpl<SimpleRequest, SimpleResponse>( |
Vijay Pai | ab1dba7 | 2015-07-31 09:09:09 -0700 | [diff] [blame] | 466 | channel_id, stub, req, AsyncStreamingClient::StartReq, |
| 467 | AsyncStreamingClient::CheckDone); |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 468 | } |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 469 | }; |
| 470 | |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 471 | class ClientGenericRpcContextStreamingImpl : public ClientRpcContext { |
| 472 | public: |
| 473 | ClientGenericRpcContextStreamingImpl( |
| 474 | int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, |
| 475 | std::function<std::unique_ptr< |
| 476 | grpc::GenericClientAsyncReaderWriter>( |
| 477 | grpc::GenericStub*, grpc::ClientContext*, const grpc::string& method_name, |
| 478 | CompletionQueue*, void*)> start_req, |
| 479 | std::function<void(grpc::Status, ByteBuffer*)> on_done) |
| 480 | : ClientRpcContext(channel_id), |
| 481 | context_(), |
| 482 | stub_(stub), |
| 483 | req_(req), |
| 484 | response_(), |
| 485 | next_state_(&ClientGenericRpcContextStreamingImpl::ReqSent), |
| 486 | callback_(on_done), |
| 487 | start_req_(start_req), |
| 488 | start_(Timer::Now()) {} |
| 489 | ~ClientGenericRpcContextStreamingImpl() GRPC_OVERRIDE {} |
| 490 | bool RunNextState(bool ok, Histogram* hist) GRPC_OVERRIDE { |
| 491 | return (this->*next_state_)(ok, hist); |
| 492 | } |
| 493 | ClientRpcContext* StartNewClone() GRPC_OVERRIDE { |
| 494 | return new ClientGenericRpcContextStreamingImpl(channel_id_, stub_, req_, |
| 495 | start_req_, callback_); |
| 496 | } |
| 497 | void Start(CompletionQueue* cq) GRPC_OVERRIDE { |
| 498 | const grpc::string kMethodName("/grpc.testing.BenchmarkService/StreamingCall"); |
| 499 | stream_ = start_req_(stub_, &context_, kMethodName, cq, ClientRpcContext::tag(this)); |
| 500 | } |
| 501 | |
| 502 | private: |
| 503 | bool ReqSent(bool ok, Histogram*) { return StartWrite(ok); } |
| 504 | bool StartWrite(bool ok) { |
| 505 | if (!ok) { |
| 506 | return (false); |
| 507 | } |
| 508 | start_ = Timer::Now(); |
| 509 | next_state_ = &ClientGenericRpcContextStreamingImpl::WriteDone; |
| 510 | stream_->Write(req_, ClientRpcContext::tag(this)); |
| 511 | return true; |
| 512 | } |
| 513 | bool WriteDone(bool ok, Histogram*) { |
| 514 | if (!ok) { |
| 515 | return (false); |
| 516 | } |
| 517 | next_state_ = &ClientGenericRpcContextStreamingImpl::ReadDone; |
| 518 | stream_->Read(&response_, ClientRpcContext::tag(this)); |
| 519 | return true; |
| 520 | } |
| 521 | bool ReadDone(bool ok, Histogram* hist) { |
| 522 | hist->Add((Timer::Now() - start_) * 1e9); |
| 523 | return StartWrite(ok); |
| 524 | } |
| 525 | grpc::ClientContext context_; |
| 526 | grpc::GenericStub* stub_; |
| 527 | ByteBuffer req_; |
| 528 | ByteBuffer response_; |
| 529 | bool (ClientGenericRpcContextStreamingImpl::*next_state_)(bool, Histogram*); |
| 530 | std::function<void(grpc::Status, ByteBuffer*)> callback_; |
| 531 | std::function< |
| 532 | std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( |
| 533 | grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, CompletionQueue*, |
| 534 | void*)> start_req_; |
| 535 | grpc::Status status_; |
| 536 | double start_; |
| 537 | std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; |
| 538 | }; |
| 539 | |
| 540 | class GenericAsyncStreamingClient GRPC_FINAL : public AsyncClient<grpc::GenericStub, ByteBuffer> { |
| 541 | public: |
| 542 | explicit GenericAsyncStreamingClient(const ClientConfig& config) |
| 543 | : AsyncClient(config, SetupCtx, grpc::GenericStub) { |
| 544 | // async streaming currently only supports closed loop |
| 545 | GPR_ASSERT(closed_loop_); |
| 546 | |
| 547 | StartThreads(config.async_client_threads()); |
| 548 | } |
| 549 | |
| 550 | ~GenericAsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); } |
| 551 | |
| 552 | private: |
| 553 | static void CheckDone(grpc::Status s, ByteBuffer* response) {} |
| 554 | static std::unique_ptr<grpc::GenericClientAsyncReaderWriter> |
| 555 | StartReq(grpc::GenericStub* stub, grpc::ClientContext* ctx, |
| 556 | const grpc::string& method_name, CompletionQueue* cq, void* tag) { |
| 557 | auto stream = stub->Call(ctx, method_name, cq, tag); |
| 558 | return stream; |
| 559 | }; |
| 560 | static ClientRpcContext* SetupCtx(int channel_id, |
| 561 | grpc::GenericStub* stub, |
| 562 | const SimpleRequest& req) { |
| 563 | return new ClientRpcContextStreamingImpl<SimpleRequest, SimpleResponse>( |
| 564 | channel_id, stub, req, AsyncStreamingClient::StartReq, |
| 565 | AsyncStreamingClient::CheckDone); |
| 566 | } |
| 567 | }; |
| 568 | |
Vijay Pai | 1da729a | 2015-03-23 12:52:56 -0700 | [diff] [blame] | 569 | std::unique_ptr<Client> CreateAsyncUnaryClient(const ClientConfig& args) { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 570 | return std::unique_ptr<Client>(new AsyncUnaryClient(args)); |
| 571 | } |
Vijay Pai | 1da729a | 2015-03-23 12:52:56 -0700 | [diff] [blame] | 572 | std::unique_ptr<Client> CreateAsyncStreamingClient(const ClientConfig& args) { |
vjpai | 46f6523 | 2015-03-23 10:10:27 -0700 | [diff] [blame] | 573 | return std::unique_ptr<Client>(new AsyncStreamingClient(args)); |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 574 | } |
vjpai | b6df94a | 2015-11-30 15:52:50 -0800 | [diff] [blame^] | 575 | std::unique_ptr<Client> CreateGenericAsyncStreamingClient(const ClientConfig& args) { |
| 576 | return std::unique_ptr<Client>(new GenericAsyncStreamingClient(args)); |
| 577 | } |
Craig Tiller | 8856875 | 2015-03-04 10:50:43 -0800 | [diff] [blame] | 578 | |
Craig Tiller | a182bf1 | 2015-03-04 13:54:39 -0800 | [diff] [blame] | 579 | } // namespace testing |
| 580 | } // namespace grpc |