client_async.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <forward_list>
20 #include <functional>
21 #include <list>
22 #include <memory>
23 #include <mutex>
24 #include <sstream>
25 #include <string>
26 #include <thread>
27 #include <utility>
28 #include <vector>
29 
30 #include "absl/memory/memory.h"
31 
32 #include <grpc/grpc.h>
33 #include <grpc/support/cpu.h>
34 #include <grpc/support/log.h>
35 #include <grpcpp/alarm.h>
36 #include <grpcpp/channel.h>
37 #include <grpcpp/client_context.h>
39 
41 #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
42 #include "test/cpp/qps/client.h"
45 
46 namespace grpc {
47 namespace testing {
48 
50  public:
52  virtual ~ClientRpcContext() {}
53  // next state, return false if done. Collect stats when appropriate
54  virtual bool RunNextState(bool, HistogramEntry* entry) = 0;
55  virtual void StartNewClone(CompletionQueue* cq) = 0;
56  static void* tag(ClientRpcContext* c) { return static_cast<void*>(c); }
57  static ClientRpcContext* detag(void* t) {
58  return static_cast<ClientRpcContext*>(t);
59  }
60 
61  virtual void Start(CompletionQueue* cq, const ClientConfig& config) = 0;
62  virtual void TryCancel() = 0;
63 };
64 
65 template <class RequestType, class ResponseType>
67  public:
69  BenchmarkService::Stub* stub, const RequestType& req,
70  std::function<gpr_timespec()> next_issue,
73  BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
75  prepare_req,
77  : context_(),
78  stub_(stub),
79  cq_(nullptr),
80  req_(req),
81  response_(),
83  callback_(on_done),
84  next_issue_(std::move(next_issue)),
85  prepare_req_(prepare_req) {}
87  void Start(CompletionQueue* cq, const ClientConfig& config) override {
88  GPR_ASSERT(!config.use_coalesce_api()); // not supported.
90  }
91  bool RunNextState(bool /*ok*/, HistogramEntry* entry) override {
92  switch (next_state_) {
93  case State::READY:
96  response_reader_->StartCall();
97  next_state_ = State::RESP_DONE;
99  ClientRpcContext::tag(this));
100  return true;
101  case State::RESP_DONE:
102  if (status_.ok()) {
103  entry->set_value((UsageTimer::Now() - start_) * 1e9);
104  }
105  callback_(status_, &response_, entry);
107  return false;
108  default:
109  GPR_ASSERT(false);
110  return false;
111  }
112  }
113  void StartNewClone(CompletionQueue* cq) override {
114  auto* clone = new ClientRpcContextUnaryImpl(stub_, req_, next_issue_,
116  clone->StartInternal(cq);
117  }
118  void TryCancel() override { context_.TryCancel(); }
119 
120  private:
122  BenchmarkService::Stub* stub_;
124  std::unique_ptr<Alarm> alarm_;
131  std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
132  BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
133  CompletionQueue*)>
136  double start_;
137  std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>
139 
141  cq_ = cq;
142  if (!next_issue_) { // ready to issue
143  RunNextState(true, nullptr);
144  } else { // wait for the issue time
145  alarm_ = absl::make_unique<Alarm>();
147  }
148  }
149 };
150 
151 template <class StubType, class RequestType>
152 class AsyncClient : public ClientImpl<StubType, RequestType> {
153  // Specify which protected members we are using since there is no
154  // member name resolution until the template types are fully resolved
155  public:
156  using Client::closed_loop_;
157  using Client::NextIssuer;
158  using Client::SetupLoadTest;
164  StubType*, std::function<gpr_timespec()> next_issue,
165  const RequestType&)>
166  setup_ctx,
167  std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
168  create_stub)
169  : ClientImpl<StubType, RequestType>(config, create_stub),
172 
173  int tpc = std::max(1, config.threads_per_cq()); // 1 if unspecified
174  int num_cqs = (num_async_threads_ + tpc - 1) / tpc; // ceiling operator
175  for (int i = 0; i < num_cqs; i++) {
176  cli_cqs_.emplace_back(new CompletionQueue);
177  }
178 
179  for (int i = 0; i < num_async_threads_; i++) {
180  cq_.emplace_back(i % cli_cqs_.size());
181  next_issuers_.emplace_back(NextIssuer(i));
182  shutdown_state_.emplace_back(new PerThreadShutdownState());
183  }
184 
185  int t = 0;
186  for (int ch = 0; ch < config.client_channels(); ch++) {
187  for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
188  auto* cq = cli_cqs_[t].get();
189  auto ctx =
190  setup_ctx(channels_[ch].get_stub(), next_issuers_[t], request_);
191  ctx->Start(cq, config);
192  }
193  t = (t + 1) % cli_cqs_.size();
194  }
195  }
196  ~AsyncClient() override {
197  for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
198  void* got_tag;
199  bool ok;
200  while ((*cq)->Next(&got_tag, &ok)) {
201  delete ClientRpcContext::detag(got_tag);
202  }
203  }
204  }
205 
206  int GetPollCount() override {
207  int count = 0;
208  for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
209  count += grpc_get_cq_poll_num((*cq)->cq());
210  }
211  return count;
212  }
213 
214  protected:
216 
217  private:
219  mutable std::mutex mutex;
220  bool shutdown;
222  };
223 
225  int num_threads = config.async_client_threads();
226  if (num_threads <= 0) { // Use dynamic sizing
228  gpr_log(GPR_INFO, "Sizing async client to %d threads", num_threads);
229  }
230  return num_threads;
231  }
232  void DestroyMultithreading() final {
233  for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) {
234  std::lock_guard<std::mutex> lock((*ss)->mutex);
235  (*ss)->shutdown = true;
236  }
237  for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
238  (*cq)->Shutdown();
239  }
240  this->EndThreads(); // this needed for resolution
241  }
242 
243  ClientRpcContext* ProcessTag(size_t thread_idx, void* tag) {
245  if (shutdown_state_[thread_idx]->shutdown) {
246  ctx->TryCancel();
247  delete ctx;
248  bool ok;
249  while (cli_cqs_[cq_[thread_idx]]->Next(&tag, &ok)) {
251  ctx->TryCancel();
252  delete ctx;
253  }
254  return nullptr;
255  }
256  return ctx;
257  }
258 
259  void ThreadFunc(size_t thread_idx, Client::Thread* t) final {
260  void* got_tag;
261  bool ok;
262 
263  HistogramEntry entry;
264  HistogramEntry* entry_ptr = &entry;
265  if (!cli_cqs_[cq_[thread_idx]]->Next(&got_tag, &ok)) {
266  return;
267  }
268  std::mutex* shutdown_mu = &shutdown_state_[thread_idx]->mutex;
269  shutdown_mu->lock();
270  ClientRpcContext* ctx = ProcessTag(thread_idx, got_tag);
271  if (ctx == nullptr) {
272  shutdown_mu->unlock();
273  return;
274  }
275  while (cli_cqs_[cq_[thread_idx]]->DoThenAsyncNext(
276  [&, ctx, ok, entry_ptr, shutdown_mu]() {
277  if (!ctx->RunNextState(ok, entry_ptr)) {
278  // The RPC and callback are done, so clone the ctx
279  // and kickstart the new one
280  ctx->StartNewClone(cli_cqs_[cq_[thread_idx]].get());
281  delete ctx;
282  }
283  shutdown_mu->unlock();
284  },
285  &got_tag, &ok, gpr_inf_future(GPR_CLOCK_REALTIME))) {
286  t->UpdateHistogram(entry_ptr);
287  entry = HistogramEntry();
288  shutdown_mu->lock();
289  ctx = ProcessTag(thread_idx, got_tag);
290  if (ctx == nullptr) {
291  shutdown_mu->unlock();
292  return;
293  }
294  }
295  }
296 
297  std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_;
298  std::vector<int> cq_;
300  std::vector<std::unique_ptr<PerThreadShutdownState>> shutdown_state_;
301 };
302 
303 static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
304  const std::shared_ptr<Channel>& ch) {
305  return BenchmarkService::NewStub(ch);
306 }
307 
308 class AsyncUnaryClient final
309  : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
310  public:
312  : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
315  }
316  ~AsyncUnaryClient() override {}
317 
318  private:
319  static void CheckDone(const grpc::Status& s, SimpleResponse* /*response*/,
320  HistogramEntry* entry) {
321  entry->set_status(s.error_code());
322  }
323  static std::unique_ptr<grpc::ClientAsyncResponseReader<SimpleResponse>>
324  PrepareReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
326  return stub->PrepareAsyncUnaryCall(ctx, request, cq);
327  };
328  static ClientRpcContext* SetupCtx(BenchmarkService::Stub* stub,
329  std::function<gpr_timespec()> next_issue,
330  const SimpleRequest& req) {
334  }
335 };
336 
337 template <class RequestType, class ResponseType>
339  public:
341  BenchmarkService::Stub* stub, const RequestType& req,
342  std::function<gpr_timespec()> next_issue,
343  std::function<std::unique_ptr<
345  BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*)>
346  prepare_req,
347  std::function<void(grpc::Status, ResponseType*)> on_done)
348  : context_(),
349  stub_(stub),
350  cq_(nullptr),
351  req_(req),
352  response_(),
354  callback_(on_done),
355  next_issue_(std::move(next_issue)),
356  prepare_req_(prepare_req),
357  coalesce_(false) {}
359  void Start(CompletionQueue* cq, const ClientConfig& config) override {
360  StartInternal(cq, config.messages_per_stream(), config.use_coalesce_api());
361  }
362  bool RunNextState(bool ok, HistogramEntry* entry) override {
363  while (true) {
364  switch (next_state_) {
365  case State::STREAM_IDLE:
366  if (!next_issue_) { // ready to issue
367  next_state_ = State::READY_TO_WRITE;
368  } else {
369  next_state_ = State::WAIT;
370  }
371  break; // loop around, don't return
372  case State::WAIT:
373  next_state_ = State::READY_TO_WRITE;
374  alarm_ = absl::make_unique<Alarm>();
376  return true;
377  case State::READY_TO_WRITE:
378  if (!ok) {
379  return false;
380  }
382  next_state_ = State::WRITE_DONE;
384  stream_->WriteLast(req_, WriteOptions(),
385  ClientRpcContext::tag(this));
386  } else {
387  stream_->Write(req_, ClientRpcContext::tag(this));
388  }
389  return true;
390  case State::WRITE_DONE:
391  if (!ok) {
392  return false;
393  }
394  next_state_ = State::READ_DONE;
395  stream_->Read(&response_, ClientRpcContext::tag(this));
396  return true;
397  break;
398  case State::READ_DONE:
399  entry->set_value((UsageTimer::Now() - start_) * 1e9);
401  if ((messages_per_stream_ != 0) &&
403  next_state_ = State::WRITES_DONE_DONE;
404  if (coalesce_) {
405  // WritesDone should have been called on the last Write.
406  // loop around to call Finish.
407  break;
408  }
409  stream_->WritesDone(ClientRpcContext::tag(this));
410  return true;
411  }
412  next_state_ = State::STREAM_IDLE;
413  break; // loop around
414  case State::WRITES_DONE_DONE:
415  next_state_ = State::FINISH_DONE;
416  stream_->Finish(&status_, ClientRpcContext::tag(this));
417  return true;
418  case State::FINISH_DONE:
420  return false;
421  break;
422  default:
423  GPR_ASSERT(false);
424  return false;
425  }
426  }
427  }
428  void StartNewClone(CompletionQueue* cq) override {
429  auto* clone = new ClientRpcContextStreamingPingPongImpl(
431  clone->StartInternal(cq, messages_per_stream_, coalesce_);
432  }
433  void TryCancel() override { context_.TryCancel(); }
434 
435  private:
437  BenchmarkService::Stub* stub_;
439  std::unique_ptr<Alarm> alarm_;
442  enum State {
451  };
456  std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
457  BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*)>
460  double start_;
461  std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>
463 
464  // Allow a limit on number of messages in a stream
467  // Whether to use coalescing API.
468  bool coalesce_;
469 
470  void StartInternal(CompletionQueue* cq, int messages_per_stream,
471  bool coalesce) {
472  cq_ = cq;
473  messages_per_stream_ = messages_per_stream;
474  messages_issued_ = 0;
475  coalesce_ = coalesce;
476  if (coalesce_) {
479  }
481  next_state_ = State::STREAM_IDLE;
482  stream_->StartCall(ClientRpcContext::tag(this));
483  if (coalesce_) {
484  // When the initial metadata is corked, the tag will not come back and we
485  // need to manually drive the state machine.
486  RunNextState(true, nullptr);
487  }
488  }
489 };
490 
492  : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
493  public:
495  : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
498  }
499 
501 
502  private:
503  static void CheckDone(const grpc::Status& /*s*/,
504  SimpleResponse* /*response*/) {}
505  static std::unique_ptr<
507  PrepareReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
508  CompletionQueue* cq) {
509  auto stream = stub->PrepareAsyncStreamingCall(ctx, cq);
510  return stream;
511  };
512  static ClientRpcContext* SetupCtx(BenchmarkService::Stub* stub,
513  std::function<gpr_timespec()> next_issue,
514  const SimpleRequest& req) {
517  stub, req, std::move(next_issue),
520  }
521 };
522 
523 template <class RequestType, class ResponseType>
525  public:
527  BenchmarkService::Stub* stub, const RequestType& req,
528  std::function<gpr_timespec()> next_issue,
530  BenchmarkService::Stub*, grpc::ClientContext*, ResponseType*,
531  CompletionQueue*)>
532  prepare_req,
533  std::function<void(grpc::Status, ResponseType*)> on_done)
534  : context_(),
535  stub_(stub),
536  cq_(nullptr),
537  req_(req),
538  response_(),
540  callback_(on_done),
541  next_issue_(std::move(next_issue)),
542  prepare_req_(prepare_req) {}
544  void Start(CompletionQueue* cq, const ClientConfig& config) override {
545  GPR_ASSERT(!config.use_coalesce_api()); // not supported yet.
546  StartInternal(cq);
547  }
548  bool RunNextState(bool ok, HistogramEntry* entry) override {
549  while (true) {
550  switch (next_state_) {
551  case State::STREAM_IDLE:
552  if (!next_issue_) { // ready to issue
553  next_state_ = State::READY_TO_WRITE;
554  } else {
555  next_state_ = State::WAIT;
556  }
557  break; // loop around, don't return
558  case State::WAIT:
559  alarm_ = absl::make_unique<Alarm>();
561  next_state_ = State::READY_TO_WRITE;
562  return true;
563  case State::READY_TO_WRITE:
564  if (!ok) {
565  return false;
566  }
568  next_state_ = State::WRITE_DONE;
569  stream_->Write(req_, ClientRpcContext::tag(this));
570  return true;
571  case State::WRITE_DONE:
572  if (!ok) {
573  return false;
574  }
575  entry->set_value((UsageTimer::Now() - start_) * 1e9);
576  next_state_ = State::STREAM_IDLE;
577  break; // loop around
578  default:
579  GPR_ASSERT(false);
580  return false;
581  }
582  }
583  }
584  void StartNewClone(CompletionQueue* cq) override {
585  auto* clone = new ClientRpcContextStreamingFromClientImpl(
587  clone->StartInternal(cq);
588  }
589  void TryCancel() override { context_.TryCancel(); }
590 
591  private:
593  BenchmarkService::Stub* stub_;
595  std::unique_ptr<Alarm> alarm_;
598  enum State {
604  };
608  std::function<std::unique_ptr<grpc::ClientAsyncWriter<RequestType>>(
609  BenchmarkService::Stub*, grpc::ClientContext*, ResponseType*,
610  CompletionQueue*)>
613  double start_;
614  std::unique_ptr<grpc::ClientAsyncWriter<RequestType>> stream_;
615 
617  cq_ = cq;
619  next_state_ = State::STREAM_IDLE;
620  stream_->StartCall(ClientRpcContext::tag(this));
621  }
622 };
623 
625  : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
626  public:
628  : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
631  }
632 
634 
635  private:
636  static void CheckDone(const grpc::Status& /*s*/,
637  SimpleResponse* /*response*/) {}
638  static std::unique_ptr<grpc::ClientAsyncWriter<SimpleRequest>> PrepareReq(
639  BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
641  auto stream = stub->PrepareAsyncStreamingFromClient(ctx, resp, cq);
642  return stream;
643  };
644  static ClientRpcContext* SetupCtx(BenchmarkService::Stub* stub,
645  std::function<gpr_timespec()> next_issue,
646  const SimpleRequest& req) {
649  stub, req, std::move(next_issue),
652  }
653 };
654 
655 template <class RequestType, class ResponseType>
657  public:
659  BenchmarkService::Stub* stub, const RequestType& req,
660  std::function<gpr_timespec()> next_issue,
662  BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
663  CompletionQueue*)>
664  prepare_req,
665  std::function<void(grpc::Status, ResponseType*)> on_done)
666  : context_(),
667  stub_(stub),
668  cq_(nullptr),
669  req_(req),
670  response_(),
672  callback_(on_done),
673  next_issue_(std::move(next_issue)),
674  prepare_req_(prepare_req) {}
676  void Start(CompletionQueue* cq, const ClientConfig& config) override {
677  GPR_ASSERT(!config.use_coalesce_api()); // not supported
678  StartInternal(cq);
679  }
680  bool RunNextState(bool ok, HistogramEntry* entry) override {
681  while (true) {
682  switch (next_state_) {
683  case State::STREAM_IDLE:
684  if (!ok) {
685  return false;
686  }
688  next_state_ = State::READ_DONE;
689  stream_->Read(&response_, ClientRpcContext::tag(this));
690  return true;
691  case State::READ_DONE:
692  if (!ok) {
693  return false;
694  }
695  entry->set_value((UsageTimer::Now() - start_) * 1e9);
697  next_state_ = State::STREAM_IDLE;
698  break; // loop around
699  default:
700  GPR_ASSERT(false);
701  return false;
702  }
703  }
704  }
705  void StartNewClone(CompletionQueue* cq) override {
706  auto* clone = new ClientRpcContextStreamingFromServerImpl(
708  clone->StartInternal(cq);
709  }
710  void TryCancel() override { context_.TryCancel(); }
711 
712  private:
714  BenchmarkService::Stub* stub_;
716  std::unique_ptr<Alarm> alarm_;
723  std::function<std::unique_ptr<grpc::ClientAsyncReader<ResponseType>>(
724  BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
725  CompletionQueue*)>
728  double start_;
729  std::unique_ptr<grpc::ClientAsyncReader<ResponseType>> stream_;
730 
732  // TODO(vjpai): Add support to rate-pace this
733  cq_ = cq;
735  next_state_ = State::STREAM_IDLE;
736  stream_->StartCall(ClientRpcContext::tag(this));
737  }
738 };
739 
741  : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
742  public:
744  : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
747  }
748 
750 
751  private:
752  static void CheckDone(const grpc::Status& /*s*/,
753  SimpleResponse* /*response*/) {}
754  static std::unique_ptr<grpc::ClientAsyncReader<SimpleResponse>> PrepareReq(
755  BenchmarkService::Stub* stub, grpc::ClientContext* ctx,
756  const SimpleRequest& req, CompletionQueue* cq) {
757  auto stream = stub->PrepareAsyncStreamingFromServer(ctx, req, cq);
758  return stream;
759  };
760  static ClientRpcContext* SetupCtx(BenchmarkService::Stub* stub,
761  std::function<gpr_timespec()> next_issue,
762  const SimpleRequest& req) {
765  stub, req, std::move(next_issue),
768  }
769 };
770 
772  public:
775  std::function<gpr_timespec()> next_issue,
776  std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
779  prepare_req,
780  std::function<void(grpc::Status, ByteBuffer*)> on_done)
781  : context_(),
782  stub_(stub),
783  cq_(nullptr),
784  req_(req),
785  response_(),
787  callback_(std::move(on_done)),
788  next_issue_(std::move(next_issue)),
789  prepare_req_(std::move(prepare_req)) {}
791  void Start(CompletionQueue* cq, const ClientConfig& config) override {
792  GPR_ASSERT(!config.use_coalesce_api()); // not supported yet.
793  StartInternal(cq, config.messages_per_stream());
794  }
795  bool RunNextState(bool ok, HistogramEntry* entry) override {
796  while (true) {
797  switch (next_state_) {
798  case State::STREAM_IDLE:
799  if (!next_issue_) { // ready to issue
800  next_state_ = State::READY_TO_WRITE;
801  } else {
802  next_state_ = State::WAIT;
803  }
804  break; // loop around, don't return
805  case State::WAIT:
806  next_state_ = State::READY_TO_WRITE;
807  alarm_ = absl::make_unique<Alarm>();
809  return true;
810  case State::READY_TO_WRITE:
811  if (!ok) {
812  return false;
813  }
815  next_state_ = State::WRITE_DONE;
816  stream_->Write(req_, ClientRpcContext::tag(this));
817  return true;
818  case State::WRITE_DONE:
819  if (!ok) {
820  return false;
821  }
822  next_state_ = State::READ_DONE;
823  stream_->Read(&response_, ClientRpcContext::tag(this));
824  return true;
825  case State::READ_DONE:
826  entry->set_value((UsageTimer::Now() - start_) * 1e9);
828  if ((messages_per_stream_ != 0) &&
830  next_state_ = State::WRITES_DONE_DONE;
831  stream_->WritesDone(ClientRpcContext::tag(this));
832  return true;
833  }
834  next_state_ = State::STREAM_IDLE;
835  break; // loop around
836  case State::WRITES_DONE_DONE:
837  next_state_ = State::FINISH_DONE;
838  stream_->Finish(&status_, ClientRpcContext::tag(this));
839  return true;
840  case State::FINISH_DONE:
842  return false;
843  default:
844  GPR_ASSERT(false);
845  return false;
846  }
847  }
848  }
849  void StartNewClone(CompletionQueue* cq) override {
850  auto* clone = new ClientRpcContextGenericStreamingImpl(
852  clone->StartInternal(cq, messages_per_stream_);
853  }
854  void TryCancel() override { context_.TryCancel(); }
855 
856  private:
860  std::unique_ptr<Alarm> alarm_;
863  enum State {
872  };
876  std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
878  CompletionQueue*)>
881  double start_;
882  std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_;
883 
884  // Allow a limit on number of messages in a stream
887 
888  void StartInternal(CompletionQueue* cq, int messages_per_stream) {
889  cq_ = cq;
890  const std::string kMethodName(
891  "/grpc.testing.BenchmarkService/StreamingCall");
892  messages_per_stream_ = messages_per_stream;
893  messages_issued_ = 0;
894  stream_ = prepare_req_(stub_, &context_, kMethodName, cq);
895  next_state_ = State::STREAM_IDLE;
896  stream_->StartCall(ClientRpcContext::tag(this));
897  }
898 };
899 
900 static std::unique_ptr<grpc::GenericStub> GenericStubCreator(
901  const std::shared_ptr<Channel>& ch) {
902  return absl::make_unique<grpc::GenericStub>(ch);
903 }
904 
906  : public AsyncClient<grpc::GenericStub, ByteBuffer> {
907  public:
912  }
913 
915 
916  private:
917  static void CheckDone(const grpc::Status& /*s*/, ByteBuffer* /*response*/) {}
918  static std::unique_ptr<grpc::GenericClientAsyncReaderWriter> PrepareReq(
921  auto stream = stub->PrepareCall(ctx, method_name, cq);
922  return stream;
923  };
925  std::function<gpr_timespec()> next_issue,
926  const ByteBuffer& req) {
928  stub, req, std::move(next_issue),
931  }
932 };
933 
934 std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& config) {
935  switch (config.rpc_type()) {
936  case UNARY:
937  return std::unique_ptr<Client>(new AsyncUnaryClient(config));
938  case STREAMING:
939  return std::unique_ptr<Client>(new AsyncStreamingPingPongClient(config));
940  case STREAMING_FROM_CLIENT:
941  return std::unique_ptr<Client>(
943  case STREAMING_FROM_SERVER:
944  return std::unique_ptr<Client>(
946  case STREAMING_BOTH_WAYS:
947  // TODO(vjpai): Implement this
948  assert(false);
949  return nullptr;
950  default:
951  assert(false);
952  return nullptr;
953  }
954 }
955 std::unique_ptr<Client> CreateGenericAsyncStreamingClient(
956  const ClientConfig& config) {
957  return std::unique_ptr<Client>(new GenericAsyncStreamingClient(config));
958 }
959 
960 } // namespace testing
961 } // namespace grpc
grpc::testing::ClientRpcContextStreamingPingPongImpl::cq_
CompletionQueue * cq_
Definition: client_async.cc:438
grpc::testing::GenericAsyncStreamingClient
Definition: client_async.cc:905
messages_pb2.SimpleRequest
SimpleRequest
Definition: messages_pb2.py:597
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
testing
Definition: aws_request_signer_test.cc:25
grpc::testing::ClientRpcContext::detag
static ClientRpcContext * detag(void *t)
Definition: client_async.cc:57
grpc::testing::ClientRpcContext::tag
static void * tag(ClientRpcContext *c)
Definition: client_async.cc:56
grpc::testing::HistogramEntry::set_status
void set_status(int status)
Definition: client.h:123
grpc::testing::AsyncStreamingPingPongClient::SetupCtx
static ClientRpcContext * SetupCtx(BenchmarkService::Stub *stub, std::function< gpr_timespec()> next_issue, const SimpleRequest &req)
Definition: client_async.cc:512
grpc::testing::ClientRpcContextStreamingFromServerImpl::~ClientRpcContextStreamingFromServerImpl
~ClientRpcContextStreamingFromServerImpl() override
Definition: client_async.cc:675
grpc._simple_stubs.RequestType
RequestType
Definition: _simple_stubs.py:27
grpc._simple_stubs.ResponseType
ResponseType
Definition: _simple_stubs.py:28
log.h
grpc::testing::ClientRpcContextStreamingFromServerImpl::status_
grpc::Status status_
Definition: client_async.cc:727
grpc::testing::AsyncClient
Definition: client_async.cc:152
grpc::testing::ClientRpcContextUnaryImpl::ClientRpcContextUnaryImpl
ClientRpcContextUnaryImpl(BenchmarkService::Stub *stub, const RequestType &req, std::function< gpr_timespec()> next_issue, std::function< std::unique_ptr< grpc::ClientAsyncResponseReader< ResponseType >>(BenchmarkService::Stub *, grpc::ClientContext *, const RequestType &, CompletionQueue *)> prepare_req, std::function< void(grpc::Status, ResponseType *, HistogramEntry *)> on_done)
Definition: client_async.cc:68
grpc::testing::ClientRpcContext
Definition: client_async.cc:49
ctx
Definition: benchmark-async.c:30
grpc::testing::CreateGenericAsyncStreamingClient
std::unique_ptr< Client > CreateGenericAsyncStreamingClient(const ClientConfig &config)
Definition: client_async.cc:955
grpc::testing::ClientRpcContextGenericStreamingImpl::prepare_req_
std::function< std::unique_ptr< grpc::GenericClientAsyncReaderWriter > grpc::GenericStub *, grpc::ClientContext *, const std::string &, CompletionQueue *)> prepare_req_
Definition: client_async.cc:879
grpc::testing::ClientRpcContextUnaryImpl::context_
grpc::ClientContext context_
Definition: client_async.cc:121
grpc::testing::GenericStubCreator
static std::unique_ptr< grpc::GenericStub > GenericStubCreator(const std::shared_ptr< Channel > &ch)
Definition: client_async.cc:900
setup_ctx
static bool setup_ctx(SSL *ssl, EVP_MD_CTX *ctx, EVP_PKEY *pkey, uint16_t sigalg, bool is_verify)
Definition: ssl_privkey.cc:172
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::ClientRpcContextUnaryImpl::prepare_req_
std::function< std::unique_ptr< grpc::ClientAsyncResponseReader< ResponseType > > BenchmarkService::Stub *, grpc::ClientContext *, const RequestType &, CompletionQueue *)> prepare_req_
Definition: client_async.cc:134
grpc::testing::ClientRpcContextUnaryImpl::StartInternal
void StartInternal(CompletionQueue *cq)
Definition: client_async.cc:140
grpc::testing::ClientRpcContextGenericStreamingImpl::alarm_
std::unique_ptr< Alarm > alarm_
Definition: client_async.cc:860
grpc::testing::ClientRpcContextUnaryImpl::READY
@ READY
Definition: client_async.cc:127
grpc::Status::ok
bool ok() const
Is the status OK?
Definition: include/grpcpp/impl/codegen/status.h:126
false
#define false
Definition: setup_once.h:323
mutex
static uv_mutex_t mutex
Definition: threadpool.c:34
grpc::testing::ClientRpcContextStreamingFromClientImpl::TryCancel
void TryCancel() override
Definition: client_async.cc:589
grpc::testing::ClientRpcContextStreamingPingPongImpl::stub_
BenchmarkService::Stub * stub_
Definition: client_async.cc:437
grpc::testing::ClientRpcContextUnaryImpl::response_
ResponseType response_
Definition: client_async.cc:126
grpc::testing::ClientRpcContextGenericStreamingImpl::req_
ByteBuffer req_
Definition: client_async.cc:861
grpc::testing::AsyncUnaryClient::AsyncUnaryClient
AsyncUnaryClient(const ClientConfig &config)
Definition: client_async.cc:311
grpc::testing::ClientRpcContextGenericStreamingImpl::cq_
CompletionQueue * cq_
Definition: client_async.cc:859
grpc::testing::ClientRpcContextStreamingPingPongImpl::WAIT
@ WAIT
Definition: client_async.cc:445
grpc::testing::ClientRpcContextGenericStreamingImpl
Definition: client_async.cc:771
grpc::testing::AsyncClient::~AsyncClient
~AsyncClient() override
Definition: client_async.cc:196
grpc::testing::ClientRpcContextStreamingPingPongImpl::READ_DONE
@ READ_DONE
Definition: client_async.cc:448
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc::testing::ClientRpcContextGenericStreamingImpl::stream_
std::unique_ptr< grpc::GenericClientAsyncReaderWriter > stream_
Definition: client_async.cc:882
grpc::testing::ClientRpcContextUnaryImpl::INVALID
@ INVALID
Definition: client_async.cc:127
grpc::testing::ClientRpcContextUnaryImpl::response_reader_
std::unique_ptr< grpc::ClientAsyncResponseReader< ResponseType > > response_reader_
Definition: client_async.cc:138
grpc::testing::ClientRpcContextStreamingFromClientImpl::alarm_
std::unique_ptr< Alarm > alarm_
Definition: client_async.cc:595
completion_queue.h
grpc::testing::ClientRpcContextGenericStreamingImpl::callback_
std::function< void(grpc::Status, ByteBuffer *)> callback_
Definition: client_async.cc:874
grpc::testing::ClientImpl< BenchmarkService::Stub, SimpleRequest >::request
const SimpleRequest * request()
Definition: client.h:445
grpc::testing::Client::SetupLoadTest
void SetupLoadTest(const ClientConfig &config, size_t num_threads)
Definition: client.h:355
grpc::testing::AsyncClient::num_async_threads_
const int num_async_threads_
Definition: client_async.cc:215
grpc::testing::ClientRpcContextUnaryImpl::RunNextState
bool RunNextState(bool, HistogramEntry *entry) override
Definition: client_async.cc:91
grpc::testing::Client::Thread
Definition: client.h:257
gpr_inf_future
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
Definition: src/core/lib/gpr/time.cc:55
grpc::testing::AsyncStreamingFromClientClient::SetupCtx
static ClientRpcContext * SetupCtx(BenchmarkService::Stub *stub, std::function< gpr_timespec()> next_issue, const SimpleRequest &req)
Definition: client_async.cc:644
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
grpc::testing::ClientRpcContextGenericStreamingImpl::status_
grpc::Status status_
Definition: client_async.cc:880
grpc::testing::ClientRpcContextStreamingPingPongImpl::messages_per_stream_
int messages_per_stream_
Definition: client_async.cc:465
UsageTimer::Now
static double Now()
Definition: usage_timer.cc:38
grpc::testing::AsyncClient::ThreadFunc
void ThreadFunc(size_t thread_idx, Client::Thread *t) final
Definition: client_async.cc:259
grpc::testing::AsyncStreamingPingPongClient::PrepareReq
static std::unique_ptr< grpc::ClientAsyncReaderWriter< SimpleRequest, SimpleResponse > > PrepareReq(BenchmarkService::Stub *stub, grpc::ClientContext *ctx, CompletionQueue *cq)
Definition: client_async.cc:507
alarm.h
async_greeter_client.stub
stub
Definition: hellostreamingworld/async_greeter_client.py:26
grpc::testing::AsyncClient::NumThreads
int NumThreads(const ClientConfig &config)
Definition: client_async.cc:224
grpc::testing::ClientRpcContextStreamingFromServerImpl::next_issue_
std::function< gpr_timespec()> next_issue_
Definition: client_async.cc:722
create_test_channel.h
grpc::testing::ClientRpcContextStreamingFromClientImpl::State
State
Definition: client_async.cc:598
absl::base_internal::Next
static AllocList * Next(int i, AllocList *prev, LowLevelAlloc::Arena *arena)
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:453
grpc::testing::ClientRpcContextStreamingFromServerImpl::INVALID
@ INVALID
Definition: client_async.cc:719
grpc::testing::ClientRpcContextGenericStreamingImpl::StartInternal
void StartInternal(CompletionQueue *cq, int messages_per_stream)
Definition: client_async.cc:888
grpc::testing::AsyncClient::DestroyMultithreading
void DestroyMultithreading() final
Definition: client_async.cc:232
grpc::testing::ClientRpcContextStreamingPingPongImpl::prepare_req_
std::function< std::unique_ptr< grpc::ClientAsyncReaderWriter< RequestType, ResponseType > > BenchmarkService::Stub *, grpc::ClientContext *, CompletionQueue *)> prepare_req_
Definition: client_async.cc:458
grpc::testing::ClientRpcContextUnaryImpl::cq_
CompletionQueue * cq_
Definition: client_async.cc:123
grpc::testing::GenericAsyncStreamingClient::CheckDone
static void CheckDone(const grpc::Status &, ByteBuffer *)
Definition: client_async.cc:917
grpc::testing::shutdown_mu
static gpr_mu shutdown_mu
Definition: bm_cq.cc:162
grpc::testing::ClientRpcContextUnaryImpl::status_
grpc::Status status_
Definition: client_async.cc:135
grpc::testing::Client::NextIssuer
std::function< gpr_timespec()> NextIssuer(int thread_idx)
Definition: client.h:388
grpc::testing::ClientRpcContextStreamingPingPongImpl::READY_TO_WRITE
@ READY_TO_WRITE
Definition: client_async.cc:446
grpc::testing::ClientRpcContextUnaryImpl::start_
double start_
Definition: client_async.cc:136
grpc::testing::ClientRpcContextStreamingPingPongImpl::FINISH_DONE
@ FINISH_DONE
Definition: client_async.cc:450
grpc::testing::BenchmarkStubCreator
static std::unique_ptr< BenchmarkService::Stub > BenchmarkStubCreator(const std::shared_ptr< Channel > &ch)
Definition: client_async.cc:303
grpc::testing::ClientRpcContextStreamingPingPongImpl::req_
const RequestType & req_
Definition: client_async.cc:440
grpc::testing::ClientRpcContextStreamingPingPongImpl::context_
grpc::ClientContext context_
Definition: client_async.cc:436
grpc::WriteOptions
Per-message write options.
Definition: call_op_set.h:81
grpc::testing::ClientRpcContextStreamingFromClientImpl::StartInternal
void StartInternal(CompletionQueue *cq)
Definition: client_async.cc:616
grpc::testing::ClientRpcContextStreamingFromServerImpl::callback_
std::function< void(grpc::Status, ResponseType *)> callback_
Definition: client_async.cc:721
grpc::testing::ClientRpcContext::ClientRpcContext
ClientRpcContext()
Definition: client_async.cc:51
grpc::testing::HistogramEntry::set_value
void set_value(double v)
Definition: client.h:117
grpc::ClientContext::set_initial_metadata_corked
void set_initial_metadata_corked(bool corked)
Definition: grpcpp/impl/codegen/client_context.h:357
grpc::testing::AsyncStreamingPingPongClient::AsyncStreamingPingPongClient
AsyncStreamingPingPongClient(const ClientConfig &config)
Definition: client_async.cc:494
grpc::testing::AsyncStreamingFromServerClient::AsyncStreamingFromServerClient
AsyncStreamingFromServerClient(const ClientConfig &config)
Definition: client_async.cc:743
grpc::testing::ClientRpcContextStreamingFromClientImpl::stream_
std::unique_ptr< grpc::ClientAsyncWriter< RequestType > > stream_
Definition: client_async.cc:614
grpc::testing::ClientRpcContextStreamingFromClientImpl::context_
grpc::ClientContext context_
Definition: client_async.cc:592
grpc::testing::ClientRpcContextStreamingPingPongImpl::WRITE_DONE
@ WRITE_DONE
Definition: client_async.cc:447
grpc::testing::ClientRpcContextStreamingFromServerImpl::alarm_
std::unique_ptr< Alarm > alarm_
Definition: client_async.cc:716
grpc::testing::ClientRpcContextStreamingFromClientImpl::WRITE_DONE
@ WRITE_DONE
Definition: client_async.cc:603
grpc::testing::ClientRpcContextGenericStreamingImpl::messages_per_stream_
int messages_per_stream_
Definition: client_async.cc:885
grpc::testing::ClientRpcContextStreamingFromServerImpl
Definition: client_async.cc:656
grpc::testing::ClientRpcContextStreamingPingPongImpl::WRITES_DONE_DONE
@ WRITES_DONE_DONE
Definition: client_async.cc:449
grpc::testing::ClientRpcContextStreamingPingPongImpl::ClientRpcContextStreamingPingPongImpl
ClientRpcContextStreamingPingPongImpl(BenchmarkService::Stub *stub, const RequestType &req, std::function< gpr_timespec()> next_issue, std::function< std::unique_ptr< grpc::ClientAsyncReaderWriter< RequestType, ResponseType >>(BenchmarkService::Stub *, grpc::ClientContext *, CompletionQueue *)> prepare_req, std::function< void(grpc::Status, ResponseType *)> on_done)
Definition: client_async.cc:340
grpc::testing::AsyncStreamingFromServerClient::~AsyncStreamingFromServerClient
~AsyncStreamingFromServerClient() override
Definition: client_async.cc:749
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc::testing::ClientRpcContextUnaryImpl
Definition: client_async.cc:66
grpc::testing::Client::StartThreads
void StartThreads(size_t num_threads)
Definition: client.h:340
grpc::testing::ClientRpcContextStreamingPingPongImpl::messages_issued_
int messages_issued_
Definition: client_async.cc:466
grpc::testing::ClientRpcContextStreamingPingPongImpl::next_state_
State next_state_
Definition: client_async.cc:452
grpc::testing::ClientRpcContextStreamingPingPongImpl::TryCancel
void TryCancel() override
Definition: client_async.cc:433
grpc::testing::ClientRpcContextStreamingFromClientImpl
Definition: client_async.cc:524
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
req
static uv_connect_t req
Definition: test-connection-fail.c:30
grpc::testing::AsyncClient::shutdown_state_
std::vector< std::unique_ptr< PerThreadShutdownState > > shutdown_state_
Definition: client_async.cc:300
grpc::testing::ClientRpcContextGenericStreamingImpl::READ_DONE
@ READ_DONE
Definition: client_async.cc:869
grpc::testing::ClientRpcContext::Start
virtual void Start(CompletionQueue *cq, const ClientConfig &config)=0
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
grpc::testing::ClientRpcContextStreamingPingPongImpl::status_
grpc::Status status_
Definition: client_async.cc:459
grpc::testing::AsyncClient::cq_
std::vector< int > cq_
Definition: client_async.cc:298
http2_server_health_check.resp
resp
Definition: http2_server_health_check.py:31
grpc::testing::AsyncStreamingFromServerClient::SetupCtx
static ClientRpcContext * SetupCtx(BenchmarkService::Stub *stub, std::function< gpr_timespec()> next_issue, const SimpleRequest &req)
Definition: client_async.cc:760
grpc.h
grpc::testing::ClientRpcContextUnaryImpl::State
State
Definition: client_async.cc:127
grpc::testing::ClientRpcContextStreamingPingPongImpl::alarm_
std::unique_ptr< Alarm > alarm_
Definition: client_async.cc:439
grpc::testing::ClientRpcContextStreamingFromServerImpl::ClientRpcContextStreamingFromServerImpl
ClientRpcContextStreamingFromServerImpl(BenchmarkService::Stub *stub, const RequestType &req, std::function< gpr_timespec()> next_issue, std::function< std::unique_ptr< grpc::ClientAsyncReader< ResponseType >>(BenchmarkService::Stub *, grpc::ClientContext *, const RequestType &, CompletionQueue *)> prepare_req, std::function< void(grpc::Status, ResponseType *)> on_done)
Definition: client_async.cc:658
grpc::testing::AsyncClient::ProcessTag
ClientRpcContext * ProcessTag(size_t thread_idx, void *tag)
Definition: client_async.cc:243
framework.rpc.grpc_csds.ClientConfig
ClientConfig
Definition: grpc_csds.py:40
grpc::testing::ClientRpcContextGenericStreamingImpl::FINISH_DONE
@ FINISH_DONE
Definition: client_async.cc:871
grpc::testing::ClientRpcContextStreamingFromClientImpl::response_
ResponseType response_
Definition: client_async.cc:597
grpc::testing::ClientRpcContextStreamingPingPongImpl::StartNewClone
void StartNewClone(CompletionQueue *cq) override
Definition: client_async.cc:428
cpu.h
grpc::testing::ClientImpl::cores_
const int cores_
Definition: client.h:503
grpc::testing::ClientRpcContextStreamingFromClientImpl::prepare_req_
std::function< std::unique_ptr< grpc::ClientAsyncWriter< RequestType > > BenchmarkService::Stub *, grpc::ClientContext *, ResponseType *, CompletionQueue *)> prepare_req_
Definition: client_async.cc:611
grpc::testing::ClientRpcContextUnaryImpl::alarm_
std::unique_ptr< Alarm > alarm_
Definition: client_async.cc:124
channel.h
grpc::testing::AsyncStreamingFromServerClient::PrepareReq
static std::unique_ptr< grpc::ClientAsyncReader< SimpleResponse > > PrepareReq(BenchmarkService::Stub *stub, grpc::ClientContext *ctx, const SimpleRequest &req, CompletionQueue *cq)
Definition: client_async.cc:754
grpc::ByteBuffer
A sequence of bytes.
Definition: include/grpcpp/impl/codegen/byte_buffer.h:61
grpc::testing::ClientRpcContextStreamingPingPongImpl::response_
ResponseType response_
Definition: client_async.cc:441
grpc::testing::ClientRpcContextGenericStreamingImpl::context_
grpc::ClientContext context_
Definition: client_async.cc:857
grpc::testing::GenericAsyncStreamingClient::GenericAsyncStreamingClient
GenericAsyncStreamingClient(const ClientConfig &config)
Definition: client_async.cc:908
grpc::testing::ClientRpcContextStreamingFromServerImpl::STREAM_IDLE
@ STREAM_IDLE
Definition: client_async.cc:719
grpc::testing::ClientRpcContextStreamingPingPongImpl::next_issue_
std::function< gpr_timespec()> next_issue_
Definition: client_async.cc:454
grpc::testing::ClientRpcContextStreamingPingPongImpl::start_
double start_
Definition: client_async.cc:460
grpc::testing::ClientRpcContextStreamingFromClientImpl::callback_
std::function< void(grpc::Status, ResponseType *)> callback_
Definition: client_async.cc:606
grpc::testing::ClientRpcContextUnaryImpl::next_state_
State next_state_
Definition: client_async.cc:128
grpc::testing::ClientRpcContextStreamingPingPongImpl::~ClientRpcContextStreamingPingPongImpl
~ClientRpcContextStreamingPingPongImpl() override
Definition: client_async.cc:358
grpc::testing::AsyncClient::PerThreadShutdownState::mutex
std::mutex mutex
Definition: client_async.cc:219
grpc::testing::AsyncUnaryClient::CheckDone
static void CheckDone(const grpc::Status &s, SimpleResponse *, HistogramEntry *entry)
Definition: client_async.cc:319
grpc::testing::ClientRpcContextGenericStreamingImpl::start_
double start_
Definition: client_async.cc:881
grpc::testing::AsyncClient::PerThreadShutdownState::PerThreadShutdownState
PerThreadShutdownState()
Definition: client_async.cc:221
grpc::testing::ClientRpcContextStreamingFromServerImpl::context_
grpc::ClientContext context_
Definition: client_async.cc:713
grpc::testing::GenericAsyncStreamingClient::SetupCtx
static ClientRpcContext * SetupCtx(grpc::GenericStub *stub, std::function< gpr_timespec()> next_issue, const ByteBuffer &req)
Definition: client_async.cc:924
grpc::testing::ClientRpcContextStreamingFromClientImpl::status_
grpc::Status status_
Definition: client_async.cc:612
grpc::testing::ClientRpcContextStreamingFromClientImpl::~ClientRpcContextStreamingFromClientImpl
~ClientRpcContextStreamingFromClientImpl() override
Definition: client_async.cc:543
grpc::testing::AsyncUnaryClient::~AsyncUnaryClient
~AsyncUnaryClient() override
Definition: client_async.cc:316
grpc::testing::ClientRpcContextGenericStreamingImpl::WAIT
@ WAIT
Definition: client_async.cc:866
grpc::testing::ClientRpcContextGenericStreamingImpl::RunNextState
bool RunNextState(bool ok, HistogramEntry *entry) override
Definition: client_async.cc:795
grpc::testing::ClientRpcContextGenericStreamingImpl::next_issue_
std::function< gpr_timespec()> next_issue_
Definition: client_async.cc:875
grpc::testing::ClientRpcContextStreamingFromClientImpl::cq_
CompletionQueue * cq_
Definition: client_async.cc:594
generic_stub.h
grpc::testing::AsyncUnaryClient::PrepareReq
static std::unique_ptr< grpc::ClientAsyncResponseReader< SimpleResponse > > PrepareReq(BenchmarkService::Stub *stub, grpc::ClientContext *ctx, const SimpleRequest &request, CompletionQueue *cq)
Definition: client_async.cc:324
grpc::testing::ClientRpcContextStreamingFromClientImpl::STREAM_IDLE
@ STREAM_IDLE
Definition: client_async.cc:600
grpc::testing::ClientRpcContextStreamingFromServerImpl::RunNextState
bool RunNextState(bool ok, HistogramEntry *entry) override
Definition: client_async.cc:680
INVALID
@ INVALID
Definition: alts_tsi_handshaker_test.cc:84
grpc::testing::ClientRpcContextStreamingFromClientImpl::req_
const RequestType & req_
Definition: client_async.cc:596
grpc::testing::tag
static void * tag(intptr_t t)
Definition: h2_ssl_cert_test.cc:263
grpc::ClientContext
Definition: grpcpp/impl/codegen/client_context.h:195
grpc::testing::ClientRpcContextStreamingPingPongImpl::State
State
Definition: client_async.cc:442
grpc::testing::HistogramEntry
Definition: client.h:112
grpc::testing::ClientRpcContextStreamingPingPongImpl::coalesce_
bool coalesce_
Definition: client_async.cc:468
grpc::testing::ClientRpcContext::StartNewClone
virtual void StartNewClone(CompletionQueue *cq)=0
grpc::testing::ClientRpcContextUnaryImpl::Start
void Start(CompletionQueue *cq, const ClientConfig &config) override
Definition: client_async.cc:87
grpc::testing::ClientRpcContextUnaryImpl::~ClientRpcContextUnaryImpl
~ClientRpcContextUnaryImpl() override
Definition: client_async.cc:86
grpc::testing::ClientRpcContextStreamingFromClientImpl::READY_TO_WRITE
@ READY_TO_WRITE
Definition: client_async.cc:602
grpc::testing::ClientRpcContextGenericStreamingImpl::WRITES_DONE_DONE
@ WRITES_DONE_DONE
Definition: client_async.cc:870
grpc::ClientAsyncReader
Definition: grpcpp/impl/codegen/async_stream.h:199
grpc::testing::ClientRpcContextStreamingFromClientImpl::ClientRpcContextStreamingFromClientImpl
ClientRpcContextStreamingFromClientImpl(BenchmarkService::Stub *stub, const RequestType &req, std::function< gpr_timespec()> next_issue, std::function< std::unique_ptr< grpc::ClientAsyncWriter< RequestType >>(BenchmarkService::Stub *, grpc::ClientContext *, ResponseType *, CompletionQueue *)> prepare_req, std::function< void(grpc::Status, ResponseType *)> on_done)
Definition: client_async.cc:526
grpc::testing::ClientRpcContextStreamingFromServerImpl::stream_
std::unique_ptr< grpc::ClientAsyncReader< ResponseType > > stream_
Definition: client_async.cc:729
grpc::testing::ClientRpcContextStreamingFromServerImpl::stub_
BenchmarkService::Stub * stub_
Definition: client_async.cc:714
grpc::testing::AsyncClient::PerThreadShutdownState
Definition: client_async.cc:218
client_context.h
grpc::testing::ClientRpcContextGenericStreamingImpl::State
State
Definition: client_async.cc:863
grpc::testing::ClientImpl
Definition: client.h:427
grpc::testing::ClientRpcContextStreamingFromServerImpl::Start
void Start(CompletionQueue *cq, const ClientConfig &config) override
Definition: client_async.cc:676
grpc::testing::ClientRpcContextStreamingFromServerImpl::next_state_
State next_state_
Definition: client_async.cc:720
grpc::testing::AsyncStreamingPingPongClient
Definition: client_async.cc:491
grpc::testing::ClientRpcContext::RunNextState
virtual bool RunNextState(bool, HistogramEntry *entry)=0
grpc::testing::AsyncStreamingFromClientClient::PrepareReq
static std::unique_ptr< grpc::ClientAsyncWriter< SimpleRequest > > PrepareReq(BenchmarkService::Stub *stub, grpc::ClientContext *ctx, SimpleResponse *resp, CompletionQueue *cq)
Definition: client_async.cc:638
grpc::testing::ClientRpcContextStreamingFromClientImpl::INVALID
@ INVALID
Definition: client_async.cc:599
grpc::testing::ClientRpcContextStreamingFromClientImpl::next_state_
State next_state_
Definition: client_async.cc:605
grpc::testing::AsyncClient::AsyncClient
AsyncClient(const ClientConfig &config, std::function< ClientRpcContext *(StubType *, std::function< gpr_timespec()> next_issue, const RequestType &)> setup_ctx, std::function< std::unique_ptr< StubType >(std::shared_ptr< Channel >)> create_stub)
Definition: client_async.cc:162
grpc::testing::AsyncStreamingFromClientClient
Definition: client_async.cc:624
grpc::testing::GenericAsyncStreamingClient::PrepareReq
static std::unique_ptr< grpc::GenericClientAsyncReaderWriter > PrepareReq(grpc::GenericStub *stub, grpc::ClientContext *ctx, const std::string &method_name, CompletionQueue *cq)
Definition: client_async.cc:918
grpc::testing::ClientRpcContextGenericStreamingImpl::~ClientRpcContextGenericStreamingImpl
~ClientRpcContextGenericStreamingImpl() override
Definition: client_async.cc:790
grpc::testing::ClientRpcContextGenericStreamingImpl::Start
void Start(CompletionQueue *cq, const ClientConfig &config) override
Definition: client_async.cc:791
grpc::testing::ClientImpl::request_
RequestType request_
Definition: client.h:504
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
grpc::testing::GenericAsyncStreamingClient::~GenericAsyncStreamingClient
~GenericAsyncStreamingClient() override
Definition: client_async.cc:914
gpr_timespec
struct gpr_timespec gpr_timespec
grpc::testing::ClientRpcContextStreamingFromClientImpl::start_
double start_
Definition: client_async.cc:613
grpc::testing::AsyncUnaryClient::SetupCtx
static ClientRpcContext * SetupCtx(BenchmarkService::Stub *stub, std::function< gpr_timespec()> next_issue, const SimpleRequest &req)
Definition: client_async.cc:328
grpc::testing::ClientRpcContextStreamingFromServerImpl::TryCancel
void TryCancel() override
Definition: client_async.cc:710
grpc::testing::ClientRpcContextStreamingFromServerImpl::cq_
CompletionQueue * cq_
Definition: client_async.cc:715
grpc::testing::AsyncStreamingPingPongClient::CheckDone
static void CheckDone(const grpc::Status &, SimpleResponse *)
Definition: client_async.cc:503
grpc::testing::ClientRpcContextStreamingFromServerImpl::req_
const RequestType & req_
Definition: client_async.cc:717
grpc::testing::ClientRpcContextStreamingPingPongImpl::StartInternal
void StartInternal(CompletionQueue *cq, int messages_per_stream, bool coalesce)
Definition: client_async.cc:470
grpc::testing::ClientImpl::channels_
std::vector< ClientChannelInfo > channels_
Definition: client.h:563
grpc::testing::ClientRpcContextGenericStreamingImpl::TryCancel
void TryCancel() override
Definition: client_async.cc:854
grpc::ClientContext::TryCancel
void TryCancel()
Definition: client_context.cc:157
grpc::ClientAsyncReaderWriter
Definition: grpcpp/impl/codegen/async_stream.h:513
grpc::testing::ClientRpcContextGenericStreamingImpl::StartNewClone
void StartNewClone(CompletionQueue *cq) override
Definition: client_async.cc:849
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc::testing::ClientRpcContextUnaryImpl::TryCancel
void TryCancel() override
Definition: client_async.cc:118
grpc::testing::AsyncClient::GetPollCount
int GetPollCount() override
Definition: client_async.cc:206
num_threads
static volatile int num_threads
Definition: benchmark-thread.c:30
grpc::testing::ClientRpcContextUnaryImpl::RESP_DONE
@ RESP_DONE
Definition: client_async.cc:127
grpc::testing::ClientRpcContextGenericStreamingImpl::response_
ByteBuffer response_
Definition: client_async.cc:862
grpc::testing::ClientRpcContextStreamingPingPongImpl::callback_
std::function< void(grpc::Status, ResponseType *)> callback_
Definition: client_async.cc:453
grpc::testing::ClientRpcContextGenericStreamingImpl::ClientRpcContextGenericStreamingImpl
ClientRpcContextGenericStreamingImpl(grpc::GenericStub *stub, const ByteBuffer &req, std::function< gpr_timespec()> next_issue, std::function< std::unique_ptr< grpc::GenericClientAsyncReaderWriter >(grpc::GenericStub *, grpc::ClientContext *, const std::string &method_name, CompletionQueue *)> prepare_req, std::function< void(grpc::Status, ByteBuffer *)> on_done)
Definition: client_async.cc:773
grpc::ClientAsyncResponseReader
Definition: grpcpp/impl/codegen/async_unary_call.h:37
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
grpc::testing::ClientRpcContextStreamingPingPongImpl
Definition: client_async.cc:338
ok
bool ok
Definition: async_end2end_test.cc:197
grpc::testing::ClientRpcContextStreamingFromClientImpl::StartNewClone
void StartNewClone(CompletionQueue *cq) override
Definition: client_async.cc:584
grpc::testing::Client::EndThreads
void EndThreads()
Definition: client.h:348
grpc::testing::ClientRpcContextGenericStreamingImpl::next_state_
State next_state_
Definition: client_async.cc:873
grpc::testing::ClientRpcContextStreamingFromServerImpl::READ_DONE
@ READ_DONE
Definition: client_async.cc:719
grpc::testing::ClientRpcContextUnaryImpl::stub_
BenchmarkService::Stub * stub_
Definition: client_async.cc:122
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
grpc::testing::ClientRpcContextStreamingFromClientImpl::Start
void Start(CompletionQueue *cq, const ClientConfig &config) override
Definition: client_async.cc:544
grpc::testing::ClientRpcContextStreamingFromServerImpl::StartInternal
void StartInternal(CompletionQueue *cq)
Definition: client_async.cc:731
grpc::testing::ClientRpcContextStreamingFromClientImpl::stub_
BenchmarkService::Stub * stub_
Definition: client_async.cc:593
grpc::testing::ClientRpcContext::~ClientRpcContext
virtual ~ClientRpcContext()
Definition: client_async.cc:52
grpc::testing::ClientRpcContextGenericStreamingImpl::READY_TO_WRITE
@ READY_TO_WRITE
Definition: client_async.cc:867
grpc::testing::ClientRpcContextUnaryImpl::next_issue_
std::function< gpr_timespec()> next_issue_
Definition: client_async.cc:130
grpc::testing::AsyncStreamingFromClientClient::AsyncStreamingFromClientClient
AsyncStreamingFromClientClient(const ClientConfig &config)
Definition: client_async.cc:627
grpc::testing::ClientRpcContextGenericStreamingImpl::messages_issued_
int messages_issued_
Definition: client_async.cc:886
grpc::testing::ClientRpcContextGenericStreamingImpl::STREAM_IDLE
@ STREAM_IDLE
Definition: client_async.cc:865
grpc::testing::ClientRpcContextStreamingFromClientImpl::RunNextState
bool RunNextState(bool ok, HistogramEntry *entry) override
Definition: client_async.cc:548
grpc::testing::AsyncClient::PerThreadShutdownState::shutdown
bool shutdown
Definition: client_async.cc:220
grpc::testing::ClientRpcContextGenericStreamingImpl::WRITE_DONE
@ WRITE_DONE
Definition: client_async.cc:868
grpc::testing::ClientRpcContextStreamingFromClientImpl::WAIT
@ WAIT
Definition: client_async.cc:601
grpc::testing::AsyncStreamingFromServerClient
Definition: client_async.cc:740
grpc::TemplatedGenericStub
Definition: grpcpp/generic/generic_stub.h:45
grpc::testing::AsyncStreamingPingPongClient::~AsyncStreamingPingPongClient
~AsyncStreamingPingPongClient() override
Definition: client_async.cc:500
grpc::testing::AsyncStreamingFromClientClient::CheckDone
static void CheckDone(const grpc::Status &, SimpleResponse *)
Definition: client_async.cc:636
grpc::testing::ClientRpcContextUnaryImpl::callback_
std::function< void(grpc::Status, ResponseType *, HistogramEntry *)> callback_
Definition: client_async.cc:129
grpc::testing::ClientRpcContextStreamingPingPongImpl::RunNextState
bool RunNextState(bool ok, HistogramEntry *entry) override
Definition: client_async.cc:362
grpc::testing::ClientRpcContextUnaryImpl::req_
const RequestType & req_
Definition: client_async.cc:125
grpc::testing::AsyncStreamingFromClientClient::~AsyncStreamingFromClientClient
~AsyncStreamingFromClientClient() override
Definition: client_async.cc:633
grpc::CompletionQueue
Definition: include/grpcpp/impl/codegen/completion_queue.h:104
ch
char ch
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3621
usage_timer.h
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
grpc::testing::ClientRpcContextStreamingPingPongImpl::stream_
std::unique_ptr< grpc::ClientAsyncReaderWriter< RequestType, ResponseType > > stream_
Definition: client_async.cc:462
grpc::ClientAsyncWriter
Definition: grpcpp/impl/codegen/async_stream.h:347
messages_pb2.SimpleResponse
SimpleResponse
Definition: messages_pb2.py:604
grpc::testing::ClientRpcContextStreamingPingPongImpl::INVALID
@ INVALID
Definition: client_async.cc:443
grpc::testing::ClientRpcContextStreamingFromServerImpl::StartNewClone
void StartNewClone(CompletionQueue *cq) override
Definition: client_async.cc:705
GPR_CLOCK_REALTIME
@ GPR_CLOCK_REALTIME
Definition: gpr_types.h:39
grpc::testing::ClientRpcContext::TryCancel
virtual void TryCancel()=0
grpc::testing::ClientRpcContextUnaryImpl::StartNewClone
void StartNewClone(CompletionQueue *cq) override
Definition: client_async.cc:113
grpc::testing::ClientRpcContextStreamingFromServerImpl::State
State
Definition: client_async.cc:719
tests.interop.client.create_stub
def create_stub(channel, args)
Definition: src/python/grpcio_tests/tests/interop/client.py:156
grpc::testing::ClientRpcContextGenericStreamingImpl::stub_
grpc::GenericStub * stub_
Definition: client_async.cc:858
grpc::testing::AsyncStreamingFromServerClient::CheckDone
static void CheckDone(const grpc::Status &, SimpleResponse *)
Definition: client_async.cc:752
grpc_get_cq_poll_num
int grpc_get_cq_poll_num(grpc_completion_queue *cq)
Definition: completion_queue.cc:585
grpc::testing::ClientRpcContextGenericStreamingImpl::INVALID
@ INVALID
Definition: client_async.cc:864
method_name
absl::string_view method_name
Definition: call_creds_util.cc:40
grpc::testing::ClientRpcContextStreamingPingPongImpl::Start
void Start(CompletionQueue *cq, const ClientConfig &config) override
Definition: client_async.cc:359
grpc::testing::Client::closed_loop_
bool closed_loop_
Definition: client.h:336
grpc::testing::ClientRpcContextStreamingFromServerImpl::prepare_req_
std::function< std::unique_ptr< grpc::ClientAsyncReader< ResponseType > > BenchmarkService::Stub *, grpc::ClientContext *, const RequestType &, CompletionQueue *)> prepare_req_
Definition: client_async.cc:726
grpc::testing::ClientRpcContextStreamingFromServerImpl::response_
ResponseType response_
Definition: client_async.cc:718
grpc::testing::CreateAsyncClient
std::unique_ptr< Client > CreateAsyncClient(const ClientConfig &config)
Definition: client_async.cc:934
client.h
grpc::testing::ClientRpcContextStreamingFromServerImpl::start_
double start_
Definition: client_async.cc:728
cq
static grpc_completion_queue * cq
Definition: test/core/fling/client.cc:37
grpc::testing::AsyncClient::cli_cqs_
std::vector< std::unique_ptr< CompletionQueue > > cli_cqs_
Definition: client_async.cc:297
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
grpc::testing::ClientRpcContextStreamingFromClientImpl::next_issue_
std::function< gpr_timespec()> next_issue_
Definition: client_async.cc:607
grpc::testing::AsyncUnaryClient
Definition: client_async.cc:308
grpc::testing::AsyncClient::next_issuers_
std::vector< std::function< gpr_timespec()> > next_issuers_
Definition: client_async.cc:299
grpc::testing::ClientRpcContextStreamingPingPongImpl::STREAM_IDLE
@ STREAM_IDLE
Definition: client_async.cc:444
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:46