client.h
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 #ifndef TEST_QPS_CLIENT_H
20 #define TEST_QPS_CLIENT_H
21 
22 #include <stdlib.h>
23 
24 #include <condition_variable>
25 #include <mutex>
26 #include <thread>
27 #include <unordered_map>
28 #include <vector>
29 
30 #include "absl/memory/memory.h"
31 #include "absl/strings/match.h"
32 
33 #include <grpc/support/log.h>
34 #include <grpc/support/time.h>
35 #include <grpcpp/channel.h>
38 #include <grpcpp/support/slice.h>
39 
40 #include "src/core/lib/gpr/env.h"
42 #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
43 #include "src/proto/grpc/testing/payloads.pb.h"
44 #include "test/cpp/qps/histogram.h"
47 #include "test/cpp/qps/server.h"
51 
52 #define INPROC_NAME_PREFIX "qpsinproc:"
53 
54 namespace grpc {
55 namespace testing {
56 
57 template <class RequestType>
59  public:
60  ClientRequestCreator(RequestType* /*req*/, const PayloadConfig&) {
61  // this template must be specialized
62  // fail with an assertion rather than a compile-time
63  // check since these only happen at the beginning anyway
64  GPR_ASSERT(false);
65  }
66 };
67 
68 template <>
70  public:
72  const PayloadConfig& payload_config) {
73  if (payload_config.has_bytebuf_params()) {
74  GPR_ASSERT(false); // not appropriate for this specialization
75  } else if (payload_config.has_simple_params()) {
77  req->set_response_size(payload_config.simple_params().resp_size());
78  req->mutable_payload()->set_type(
80  int size = payload_config.simple_params().req_size();
81  std::unique_ptr<char[]> body(new char[size]);
82  req->mutable_payload()->set_body(body.get(), size);
83  } else if (payload_config.has_complex_params()) {
84  GPR_ASSERT(false); // not appropriate for this specialization
85  } else {
86  // default should be simple proto without payloads
88  req->set_response_size(0);
89  req->mutable_payload()->set_type(
91  }
92  }
93 };
94 
95 template <>
97  public:
98  ClientRequestCreator(ByteBuffer* req, const PayloadConfig& payload_config) {
99  if (payload_config.has_bytebuf_params()) {
100  size_t req_sz =
101  static_cast<size_t>(payload_config.bytebuf_params().req_size());
102  std::unique_ptr<char[]> buf(new char[req_sz]);
103  memset(buf.get(), 0, req_sz);
104  Slice slice(buf.get(), req_sz);
105  *req = ByteBuffer(&slice, 1);
106  } else {
107  GPR_ASSERT(false); // not appropriate for this specialization
108  }
109  }
110 };
111 
112 class HistogramEntry final {
113  public:
115  bool value_used() const { return value_used_; }
116  double value() const { return value_; }
117  void set_value(double v) {
118  value_used_ = true;
119  value_ = v;
120  }
121  bool status_used() const { return status_used_; }
122  int status() const { return status_; }
123  void set_status(int status) {
124  status_used_ = true;
125  status_ = status;
126  }
127 
128  private:
130  double value_;
132  int status_;
133 };
134 
135 typedef std::unordered_map<int, int64_t> StatusHistogram;
136 
138  StatusHistogram* to) {
139  for (StatusHistogram::const_iterator it = from.begin(); it != from.end();
140  ++it) {
141  (*to)[it->first] += it->second;
142  }
143 }
144 
145 class Client {
146  public:
148  : timer_(new UsageTimer),
153  }
154  virtual ~Client() {}
155 
156  ClientStats Mark(bool reset) {
157  Histogram latencies;
158  StatusHistogram statuses;
159  UsageTimer::Result timer_result;
160 
162 
163  int cur_poll_count = GetPollCount();
164  int poll_count = cur_poll_count - last_reset_poll_count_;
165  if (reset) {
166  std::vector<Histogram> to_merge(threads_.size());
167  std::vector<StatusHistogram> to_merge_status(threads_.size());
168 
169  for (size_t i = 0; i < threads_.size(); i++) {
170  threads_[i]->BeginSwap(&to_merge[i], &to_merge_status[i]);
171  }
172  std::unique_ptr<UsageTimer> timer(new UsageTimer);
173  timer_.swap(timer);
174  for (size_t i = 0; i < threads_.size(); i++) {
175  latencies.Merge(to_merge[i]);
176  MergeStatusHistogram(to_merge_status[i], &statuses);
177  }
178  timer_result = timer->Mark();
179  last_reset_poll_count_ = cur_poll_count;
180  } else {
181  // merge snapshots of each thread histogram
182  for (size_t i = 0; i < threads_.size(); i++) {
183  threads_[i]->MergeStatsInto(&latencies, &statuses);
184  }
185  timer_result = timer_->Mark();
186  }
187 
188  // Print the median latency per interval for one thread.
189  // If the number of warmup seconds is x, then the first x + 1 numbers in the
190  // vector are from the warmup period and should be discarded.
192  std::vector<double> medians_per_interval =
193  threads_[0]->GetMedianPerIntervalList();
194  gpr_log(GPR_INFO, "Num threads: %zu", threads_.size());
195  gpr_log(GPR_INFO, "Number of medians: %zu", medians_per_interval.size());
196  for (size_t j = 0; j < medians_per_interval.size(); j++) {
197  gpr_log(GPR_INFO, "%f", medians_per_interval[j]);
198  }
199  }
200 
201  grpc_stats_data core_stats;
202  grpc_stats_collect(&core_stats);
203 
204  ClientStats stats;
205  latencies.FillProto(stats.mutable_latencies());
206  for (StatusHistogram::const_iterator it = statuses.begin();
207  it != statuses.end(); ++it) {
208  RequestResultCount* rrc = stats.add_request_results();
209  rrc->set_status_code(it->first);
210  rrc->set_count(it->second);
211  }
212  stats.set_time_elapsed(timer_result.wall);
213  stats.set_time_system(timer_result.system);
214  stats.set_time_user(timer_result.user);
215  stats.set_cq_poll_count(poll_count);
216  CoreStatsToProto(core_stats, stats.mutable_core_stats());
217  return stats;
218  }
219 
220  // Must call AwaitThreadsCompletion before destructor to avoid a race
221  // between destructor and invocation of virtual ThreadFunc
223  gpr_atm_rel_store(&thread_pool_done_, static_cast<gpr_atm>(true));
225  std::unique_lock<std::mutex> g(thread_completion_mu_);
226  while (threads_remaining_ != 0) {
227  threads_complete_.wait(g);
228  }
229  }
230 
231  // Returns the interval (in seconds) between collecting latency medians. If 0,
232  // no periodic median latencies will be collected.
235  }
236 
237  virtual int GetPollCount() {
238  // For sync client.
239  return 0;
240  }
241 
242  bool IsClosedLoop() { return closed_loop_; }
243 
244  gpr_timespec NextIssueTime(int thread_idx) {
245  const gpr_timespec result = next_time_[thread_idx];
246  next_time_[thread_idx] =
247  gpr_time_add(next_time_[thread_idx],
249  GPR_TIMESPAN));
250  return result;
251  }
252 
254  return static_cast<bool>(gpr_atm_acq_load(&thread_pool_done_));
255  }
256 
257  class Thread {
258  public:
260  : client_(client), idx_(idx), impl_(&Thread::ThreadFunc, this) {}
261 
262  ~Thread() { impl_.join(); }
263 
265  std::lock_guard<std::mutex> g(mu_);
266  n->Swap(&histogram_);
267  s->swap(statuses_);
268  }
269 
271  std::unique_lock<std::mutex> g(mu_);
272  hist->Merge(histogram_);
274  }
275 
276  std::vector<double> GetMedianPerIntervalList() {
278  }
279 
281  std::lock_guard<std::mutex> g(mu_);
282  if (entry->value_used()) {
283  histogram_.Add(entry->value());
286  double now = UsageTimer::Now();
287  if ((now - interval_start_time_) >=
289  // Record the median latency of requests from the last interval.
290  // Divide by 1e3 to get microseconds.
291  medians_each_interval_list_.push_back(
295  }
296  }
297  }
298  if (entry->status_used()) {
299  statuses_[entry->status()]++;
300  }
301  }
302 
303  private:
304  Thread(const Thread&);
305  Thread& operator=(const Thread&);
306 
307  void ThreadFunc() {
308  int wait_loop = 0;
309  while (!gpr_event_wait(
313  gpr_log(GPR_INFO, "%" PRIdPTR ": Waiting for benchmark to start (%d)",
314  idx_, wait_loop);
315  wait_loop++;
316  }
317 
318  client_->ThreadFunc(idx_, this);
320  }
321 
326  const size_t idx_;
328  // The following are used only if
329  // median_latency_collection_interval_seconds_ is greater than 0
331  std::vector<double> medians_each_interval_list_;
333  };
334 
335  protected:
339 
340  void StartThreads(size_t num_threads) {
341  gpr_atm_rel_store(&thread_pool_done_, static_cast<gpr_atm>(false));
343  for (size_t i = 0; i < num_threads; i++) {
344  threads_.emplace_back(new Thread(this, i));
345  }
346  }
347 
348  void EndThreads() {
350  threads_.clear();
351  }
352 
353  virtual void DestroyMultithreading() = 0;
354 
356  // Set up the load distribution based on the number of threads
357  const auto& load = config.load_params();
358 
359  std::unique_ptr<RandomDistInterface> random_dist;
360  switch (load.load_case()) {
361  case LoadParams::kClosedLoop:
362  // Closed-loop doesn't use random dist at all
363  break;
364  case LoadParams::kPoisson:
365  random_dist = absl::make_unique<ExpDist>(load.poisson().offered_load() /
366  num_threads);
367  break;
368  default:
369  GPR_ASSERT(false);
370  }
371 
372  // Set closed_loop_ based on whether or not random_dist is set
373  if (!random_dist) {
374  closed_loop_ = true;
375  } else {
376  closed_loop_ = false;
377  // set up interarrival timer according to random dist
378  interarrival_timer_.init(*random_dist, num_threads);
379  const auto now = gpr_now(GPR_CLOCK_MONOTONIC);
380  for (size_t i = 0; i < num_threads; i++) {
381  next_time_.push_back(gpr_time_add(
382  now,
384  }
385  }
386  }
387 
388  std::function<gpr_timespec()> NextIssuer(int thread_idx) {
389  return closed_loop_ ? std::function<gpr_timespec()>()
390  : std::bind(&Client::NextIssueTime, this, thread_idx);
391  }
392 
393  virtual void ThreadFunc(size_t thread_idx, Client::Thread* t) = 0;
394 
395  std::vector<std::unique_ptr<Thread>> threads_;
396  std::unique_ptr<UsageTimer> timer_;
397 
399  std::vector<gpr_timespec> next_time_;
400 
403  std::condition_variable threads_complete_;
404 
407 
409 
411  if (!started_requests_) {
412  started_requests_ = true;
413  gpr_event_set(&start_requests_, reinterpret_cast<void*>(1));
414  }
415  }
416 
417  void CompleteThread() {
418  std::lock_guard<std::mutex> g(thread_completion_mu_);
420  if (threads_remaining_ == 0) {
421  threads_complete_.notify_all();
422  }
423  }
424 };
425 
426 template <class StubType, class RequestType>
427 class ClientImpl : public Client {
428  public:
430  std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
431  create_stub)
433  for (int i = 0; i < config.client_channels(); i++) {
434  channels_.emplace_back(
435  config.server_targets(i % config.server_targets_size()), config,
436  create_stub_, i);
437  }
440  config.median_latency_collection_interval_millis() / 1e3;
442  config.payload_config());
443  }
444  ~ClientImpl() override {}
445  const RequestType* request() { return &request_; }
446 
448  int connect_deadline_seconds = 10;
449  /* Allow optionally overriding connect_deadline in order
450  * to deal with benchmark environments in which the server
451  * can take a long time to become ready. */
452  char* channel_connect_timeout_str =
453  gpr_getenv("QPS_WORKER_CHANNEL_CONNECT_TIMEOUT");
454  if (channel_connect_timeout_str != nullptr &&
455  strcmp(channel_connect_timeout_str, "") != 0) {
456  connect_deadline_seconds = atoi(channel_connect_timeout_str);
457  }
459  "Waiting for up to %d seconds for all channels to connect",
460  connect_deadline_seconds);
461  gpr_free(channel_connect_timeout_str);
462  gpr_timespec connect_deadline = gpr_time_add(
464  gpr_time_from_seconds(connect_deadline_seconds, GPR_TIMESPAN));
466  size_t num_remaining = 0;
467  for (auto& c : channels_) {
468  if (!c.is_inproc()) {
469  Channel* channel = c.get_channel();
470  grpc_connectivity_state last_observed = channel->GetState(true);
471  if (last_observed == GRPC_CHANNEL_READY) {
472  gpr_log(GPR_INFO, "Channel %p connected!", channel);
473  } else {
474  num_remaining++;
475  channel->NotifyOnStateChange(last_observed, connect_deadline, &cq,
476  channel);
477  }
478  }
479  }
480  while (num_remaining > 0) {
481  bool ok = false;
482  void* tag = nullptr;
483  cq.Next(&tag, &ok);
484  Channel* channel = static_cast<Channel*>(tag);
485  if (!ok) {
486  gpr_log(GPR_ERROR, "Channel %p failed to connect within the deadline",
487  channel);
488  abort();
489  } else {
490  grpc_connectivity_state last_observed = channel->GetState(true);
491  if (last_observed == GRPC_CHANNEL_READY) {
492  gpr_log(GPR_INFO, "Channel %p connected!", channel);
493  num_remaining--;
494  } else {
495  channel->NotifyOnStateChange(last_observed, connect_deadline, &cq,
496  channel);
497  }
498  }
499  }
500  }
501 
502  protected:
503  const int cores_;
505 
507  public:
509  const std::string& target, const ClientConfig& config,
510  std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
511  create_stub,
512  int shard) {
514  args.SetInt("shard_to_ensure_no_subchannel_merges", shard);
516 
518  if (config.has_security_params() &&
519  config.security_params().cred_type().empty()) {
521  } else {
522  type = config.security_params().cred_type();
523  }
524 
525  std::string inproc_pfx(INPROC_NAME_PREFIX);
526  if (!absl::StartsWith(target, inproc_pfx)) {
528  target, type, config.security_params().server_host_override(),
529  !config.security_params().use_test_ca(),
530  std::shared_ptr<CallCredentials>(), args);
531  gpr_log(GPR_INFO, "Connecting to %s", target.c_str());
532  is_inproc_ = false;
533  } else {
534  std::string tgt = target;
535  tgt.erase(0, inproc_pfx.length());
536  int srv_num = std::stoi(tgt);
537  channel_ = (*g_inproc_servers)[srv_num]->InProcessChannel(args);
538  is_inproc_ = true;
539  }
541  }
542  Channel* get_channel() { return channel_.get(); }
543  StubType* get_stub() { return stub_.get(); }
544  bool is_inproc() { return is_inproc_; }
545 
546  private:
548  for (const auto& channel_arg : config.channel_args()) {
549  if (channel_arg.value_case() == ChannelArg::kStrValue) {
550  args->SetString(channel_arg.name(), channel_arg.str_value());
551  } else if (channel_arg.value_case() == ChannelArg::kIntValue) {
552  args->SetInt(channel_arg.name(), channel_arg.int_value());
553  } else {
554  gpr_log(GPR_ERROR, "Empty channel arg value.");
555  }
556  }
557  }
558 
559  std::shared_ptr<Channel> channel_;
560  std::unique_ptr<StubType> stub_;
562  };
563  std::vector<ClientChannelInfo> channels_;
564  std::function<std::unique_ptr<StubType>(const std::shared_ptr<Channel>&)>
566 };
567 
568 std::unique_ptr<Client> CreateSynchronousClient(const ClientConfig& config);
569 std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& config);
570 std::unique_ptr<Client> CreateCallbackClient(const ClientConfig& config);
571 std::unique_ptr<Client> CreateGenericAsyncStreamingClient(
572  const ClientConfig& config);
573 
574 } // namespace testing
575 } // namespace grpc
576 
577 #endif
grpc::testing::InterarrivalTimer
Definition: interarrival.h:74
grpc::testing::Histogram::Merge
void Merge(const Histogram &h)
Definition: cpp/qps/histogram.h:46
test_credentials_provider.h
grpc::testing::kTlsCredentialsType
const char kTlsCredentialsType[]
Definition: test_credentials_provider.h:34
GPR_TIMESPAN
@ GPR_TIMESPAN
Definition: gpr_types.h:45
grpc::testing::ClientImpl::create_stub_
std::function< std::unique_ptr< StubType >const std::shared_ptr< Channel > &)> create_stub_
Definition: client.h:565
messages_pb2.SimpleRequest
SimpleRequest
Definition: messages_pb2.py:597
gpr_cpu_num_cores
GPRAPI unsigned gpr_cpu_num_cores(void)
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
testing
Definition: aws_request_signer_test.cc:25
GRPC_CHANNEL_READY
@ GRPC_CHANNEL_READY
Definition: include/grpc/impl/codegen/connectivity_state.h:36
grpc::testing::InterarrivalTimer::init
void init(const RandomDistInterface &r, int threads, int entries=1000000)
Definition: interarrival.h:77
grpc::testing::StatusHistogram
std::unordered_map< int, int64_t > StatusHistogram
Definition: client.h:135
now
static double now(void)
Definition: test/core/fling/client.cc:130
grpc::testing::HistogramEntry::set_status
void set_status(int status)
Definition: client.h:123
grpc::testing::Client::Thread::GetMedianPerIntervalList
std::vector< double > GetMedianPerIntervalList()
Definition: client.h:276
regen-readme.it
it
Definition: regen-readme.py:15
grpc._simple_stubs.RequestType
RequestType
Definition: _simple_stubs.py:27
log.h
grpc::testing::Client::Mark
ClientStats Mark(bool reset)
Definition: client.h:156
grpc::gpr_free
gpr_free(creds_file_name)
grpc::testing::CreateGenericAsyncStreamingClient
std::unique_ptr< Client > CreateGenericAsyncStreamingClient(const ClientConfig &config)
Definition: client_async.cc:955
memset
return memset(p, 0, total)
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::Client::NextIssueTime
gpr_timespec NextIssueTime(int thread_idx)
Definition: client.h:244
grpc::testing::Client::Thread::histogram_per_interval_
Histogram histogram_per_interval_
Definition: client.h:330
false
#define false
Definition: setup_once.h:323
mutex
static uv_mutex_t mutex
Definition: threadpool.c:34
histogram.h
grpc::testing::Client::start_requests_
gpr_event start_requests_
Definition: client.h:405
grpc::testing::ClientRequestCreator< ByteBuffer >::ClientRequestCreator
ClientRequestCreator(ByteBuffer *req, const PayloadConfig &payload_config)
Definition: client.h:98
client
Definition: examples/python/async_streaming/client.py:1
grpc::testing::Histogram::Percentile
double Percentile(double pctile) const
Definition: cpp/qps/histogram.h:48
grpc::testing::Client::timer_
std::unique_ptr< UsageTimer > timer_
Definition: client.h:396
absl::StartsWith
bool StartsWith(absl::string_view text, absl::string_view prefix) noexcept
Definition: third_party/abseil-cpp/absl/strings/match.h:58
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
grpc::testing::Client::AwaitThreadsCompletion
void AwaitThreadsCompletion()
Definition: client.h:222
gpr_event_set
GPRAPI void gpr_event_set(gpr_event *ev, void *value)
Definition: sync.cc:59
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
slice.h
grpc::testing::Client::last_reset_poll_count_
int last_reset_poll_count_
Definition: client.h:408
grpc::testing::ClientImpl::request
const RequestType * request()
Definition: client.h:445
grpc::testing::Client::SetupLoadTest
void SetupLoadTest(const ClientConfig &config, size_t num_threads)
Definition: client.h:355
grpc::testing::Histogram::FillProto
void FillProto(HistogramData *p)
Definition: cpp/qps/histogram.h:53
qps_worker.h
grpc::testing::Client::Thread
Definition: client.h:257
env.h
time.h
grpc::testing::Client::CompleteThread
void CompleteThread()
Definition: client.h:417
grpc::testing::Client::Thread::impl_
std::thread impl_
Definition: client.h:327
to
size_t to
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1385
UsageTimer::Now
static double Now()
Definition: usage_timer.cc:38
grpc::testing::ClientImpl::ClientChannelInfo::get_stub
StubType * get_stub()
Definition: client.h:543
grpc::testing::ClientImpl::ClientChannelInfo::set_channel_args
void set_channel_args(const ClientConfig &config, ChannelArguments *args)
Definition: client.h:547
env.new
def new
Definition: env.py:51
grpc::testing::Client::threads_complete_
std::condition_variable threads_complete_
Definition: client.h:403
grpc::testing::MergeStatusHistogram
void MergeStatusHistogram(const StatusHistogram &from, StatusHistogram *to)
Definition: client.h:137
create_test_channel.h
grpc::testing::ClientImpl::~ClientImpl
~ClientImpl() override
Definition: client.h:444
grpc::Channel
Channels represent a connection to an endpoint. Created by CreateChannel.
Definition: include/grpcpp/channel.h:54
grpc::testing::ClientImpl::ClientChannelInfo::get_channel
Channel * get_channel()
Definition: client.h:542
messages_pb2.COMPRESSABLE
int COMPRESSABLE
Definition: messages_pb2.py:46
grpc::testing::Client::NextIssuer
std::function< gpr_timespec()> NextIssuer(int thread_idx)
Definition: client.h:388
grpc_connectivity_state
grpc_connectivity_state
Definition: include/grpc/impl/codegen/connectivity_state.h:30
core_stats.h
interarrival.h
grpc::testing::Client::IsClosedLoop
bool IsClosedLoop()
Definition: client.h:242
grpc::testing::HistogramEntry::value_used
bool value_used() const
Definition: client.h:115
gpr_time_from_nanos
GPRAPI gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type clock_type)
Definition: src/core/lib/gpr/time.cc:111
grpc::testing::Client::Thread::statuses_
StatusHistogram statuses_
Definition: client.h:324
grpc::testing::HistogramEntry::set_value
void set_value(double v)
Definition: client.h:117
from
size_t from
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1384
grpc::testing::ClientRequestCreator
Definition: client.h:58
grpc::testing::Client::Thread::ThreadFunc
void ThreadFunc()
Definition: client.h:307
grpc::testing::ClientImpl::ClientChannelInfo::stub_
std::unique_ptr< StubType > stub_
Definition: client.h:560
grpc::testing::ClientImpl::ClientChannelInfo::is_inproc
bool is_inproc()
Definition: client.h:544
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
UsageTimer::Result::wall
double wall
Definition: usage_timer.h:27
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc::testing::HistogramEntry::status_used_
bool status_used_
Definition: client.h:131
gpr_getenv
char * gpr_getenv(const char *name)
grpc::testing::InterarrivalTimer::next
int64_t next(int thread_num)
Definition: interarrival.h:92
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
channel_arguments.h
grpc::testing::Client::StartThreads
void StartThreads(size_t num_threads)
Definition: client.h:340
INPROC_NAME_PREFIX
#define INPROC_NAME_PREFIX
Definition: client.h:52
req
static uv_connect_t req
Definition: test-connection-fail.c:30
grpc::testing::Client::next_time_
std::vector< gpr_timespec > next_time_
Definition: client.h:399
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
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::HistogramEntry::value_
double value_
Definition: client.h:130
setup.v
v
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
grpc::testing::Client::GetLatencyCollectionIntervalInSeconds
double GetLatencyCollectionIntervalInSeconds()
Definition: client.h:233
grpc::testing::ClientImpl::ClientChannelInfo
Definition: client.h:506
grpc::testing::Client::Thread::client_
Client * client_
Definition: client.h:325
gpr_atm_acq_load
#define gpr_atm_acq_load(p)
Definition: impl/codegen/atm_gcc_atomic.h:52
gen_stats_data.stats
list stats
Definition: gen_stats_data.py:58
framework.rpc.grpc_csds.ClientConfig
ClientConfig
Definition: grpc_csds.py:40
grpc::testing::Client::~Client
virtual ~Client()
Definition: client.h:154
grpc::testing::HistogramEntry::status_used
bool status_used() const
Definition: client.h:121
grpc::testing::ClientImpl::cores_
const int cores_
Definition: client.h:503
channel.h
gpr_atm_rel_store
#define gpr_atm_rel_store(p, value)
Definition: impl/codegen/atm_gcc_atomic.h:54
grpc::ByteBuffer
A sequence of bytes.
Definition: include/grpcpp/impl/codegen/byte_buffer.h:61
GPR_CLOCK_MONOTONIC
@ GPR_CLOCK_MONOTONIC
Definition: gpr_types.h:36
grpc::testing::Client::Thread::Thread
Thread(Client *client, size_t idx)
Definition: client.h:259
grpc::testing::ClientImpl::ClientChannelInfo::ClientChannelInfo
ClientChannelInfo(const std::string &target, const ClientConfig &config, std::function< std::unique_ptr< StubType >(std::shared_ptr< Channel >)> create_stub, int shard)
Definition: client.h:508
gpr_event_init
GPRAPI void gpr_event_init(gpr_event *ev)
Definition: sync.cc:54
gen_build_yaml.load
def load(*args)
Definition: test/core/end2end/gen_build_yaml.py:25
grpc_stats_collect
void grpc_stats_collect(grpc_stats_data *output)
Definition: stats.cc:48
grpc::CreateTestChannel
std::shared_ptr< Channel > CreateTestChannel(const std::string &server, const std::string &cred_type, const std::string &override_hostname, bool use_prod_roots, const std::shared_ptr< CallCredentials > &creds, const ChannelArguments &args)
Definition: create_test_channel.cc:88
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
grpc::testing::Client::ThreadFunc
virtual void ThreadFunc(size_t thread_idx, Client::Thread *t)=0
g
struct @717 g
grpc::testing::ClientImpl::ClientImpl
ClientImpl(const ClientConfig &config, std::function< std::unique_ptr< StubType >(std::shared_ptr< Channel >)> create_stub)
Definition: client.h:429
UsageTimer::Result
Definition: usage_timer.h:26
gpr_now
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
grpc::testing::ClientImpl::ClientChannelInfo::channel_
std::shared_ptr< Channel > channel_
Definition: client.h:559
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
grpc::testing::Client::Client
Client()
Definition: client.h:147
gpr_event_wait
GPRAPI void * gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline)
Definition: sync.cc:73
grpc::testing::ClientRequestCreator< SimpleRequest >::ClientRequestCreator
ClientRequestCreator(SimpleRequest *req, const PayloadConfig &payload_config)
Definition: client.h:71
grpc::testing::tag
static void * tag(intptr_t t)
Definition: h2_ssl_cert_test.cc:263
grpc::testing::Client::Thread::MergeStatsInto
void MergeStatsInto(Histogram *hist, StatusHistogram *s)
Definition: client.h:270
grpc::testing::HistogramEntry::value
double value() const
Definition: client.h:116
grpc::testing::HistogramEntry
Definition: client.h:112
UsageTimer::Result::user
double user
Definition: usage_timer.h:28
gpr_atm
intptr_t gpr_atm
Definition: impl/codegen/atm_gcc_atomic.h:32
grpc::testing::ClientImpl::WaitForChannelsToConnect
void WaitForChannelsToConnect()
Definition: client.h:447
grpc::CoreStatsToProto
void CoreStatsToProto(const grpc_stats_data &core, Stats *proto)
Definition: core_stats.cc:39
grpc::testing::Client::thread_pool_done_
gpr_atm thread_pool_done_
Definition: client.h:337
grpc::testing::CreateSynchronousClient
std::unique_ptr< Client > CreateSynchronousClient(const ClientConfig &config)
Definition: client_sync.cc:404
grpc::ChannelArguments
Definition: grpcpp/support/channel_arguments.h:39
gpr_event
Definition: impl/codegen/sync_generic.h:31
grpc::testing::Client::ThreadCompleted
bool ThreadCompleted()
Definition: client.h:253
grpc::testing::ClientImpl
Definition: client.h:427
grpc::testing::HistogramEntry::value_used_
bool value_used_
Definition: client.h:129
gpr_time_add
GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b)
Definition: src/core/lib/gpr/time.cc:135
grpc::testing::ClientImpl::request_
RequestType request_
Definition: client.h:504
grpc::testing::Client::Thread::mu_
std::mutex mu_
Definition: client.h:322
gpr_timespec
struct gpr_timespec gpr_timespec
grpc::testing::Client::threads_remaining_
size_t threads_remaining_
Definition: client.h:402
grpc::testing::Client::MaybeStartRequests
void MaybeStartRequests()
Definition: client.h:410
grpc::testing::Histogram::Reset
void Reset()
Definition: cpp/qps/histogram.h:37
grpc::testing::ClientImpl::channels_
std::vector< ClientChannelInfo > channels_
Definition: client.h:563
grpc_stats_data
Definition: src/core/lib/debug/stats.h:33
grpc::testing::Histogram::Add
void Add(double value)
Definition: cpp/qps/histogram.h:47
num_threads
static volatile int num_threads
Definition: benchmark-thread.c:30
grpc::testing::Client::Thread::operator=
Thread & operator=(const Thread &)
grpc::testing::Client::Thread::UpdateHistogram
void UpdateHistogram(HistogramEntry *entry)
Definition: client.h:280
ok
bool ok
Definition: async_end2end_test.cc:197
grpc::testing::Client::threads_
std::vector< std::unique_ptr< Thread > > threads_
Definition: client.h:395
grpc::testing::Client::EndThreads
void EndThreads()
Definition: client.h:348
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
grpc::testing::ClientImpl::ClientChannelInfo::is_inproc_
bool is_inproc_
Definition: client.h:561
grpc::testing::Client
Definition: client.h:145
grpc::testing::Client::Thread::~Thread
~Thread()
Definition: client.h:262
grpc::testing::Client::Thread::medians_each_interval_list_
std::vector< double > medians_each_interval_list_
Definition: client.h:331
grpc::testing::Histogram
Definition: cpp/qps/histogram.h:28
grpc::testing::Client::Thread::interval_start_time_
double interval_start_time_
Definition: client.h:332
grpc::testing::HistogramEntry::HistogramEntry
HistogramEntry()
Definition: client.h:114
UsageTimer::Result::system
double system
Definition: usage_timer.h:29
grpc::testing::Client::Thread::BeginSwap
void BeginSwap(Histogram *n, StatusHistogram *s)
Definition: client.h:264
grpc::testing::CreateCallbackClient
std::unique_ptr< Client > CreateCallbackClient(const ClientConfig &config)
Definition: test/cpp/qps/client_callback.cc:371
grpc::testing::HistogramEntry::status_
int status_
Definition: client.h:132
grpc::testing::Client::interarrival_timer_
InterarrivalTimer interarrival_timer_
Definition: client.h:398
grpc::testing::HistogramEntry::status
int status() const
Definition: client.h:122
grpc::testing::Client::Thread::idx_
const size_t idx_
Definition: client.h:326
grpc::CompletionQueue
Definition: include/grpcpp/impl/codegen/completion_queue.h:104
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
gpr_timespec
Definition: gpr_types.h:50
usage_timer.h
grpc::Slice
Definition: include/grpcpp/impl/codegen/slice.h:36
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
grpc::testing::ClientRequestCreator::ClientRequestCreator
ClientRequestCreator(RequestType *, const PayloadConfig &)
Definition: client.h:60
grpc::testing::Client::started_requests_
bool started_requests_
Definition: client.h:406
grpc::testing::Client::Thread::histogram_
Histogram histogram_
Definition: client.h:323
GPR_CLOCK_REALTIME
@ GPR_CLOCK_REALTIME
Definition: gpr_types.h:39
grpc::testing::Client::thread_completion_mu_
std::mutex thread_completion_mu_
Definition: client.h:401
tests.interop.client.create_stub
def create_stub(channel, args)
Definition: src/python/grpcio_tests/tests/interop/client.py:156
grpc::testing::Client::median_latency_collection_interval_seconds_
double median_latency_collection_interval_seconds_
Definition: client.h:338
grpc::testing::Client::closed_loop_
bool closed_loop_
Definition: client.h:336
UsageTimer
Definition: usage_timer.h:22
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
grpc::testing::CreateAsyncClient
std::unique_ptr< Client > CreateAsyncClient(const ClientConfig &config)
Definition: client_async.cc:934
thread
static uv_thread_t thread
Definition: test-async-null-cb.c:29
cq
static grpc_completion_queue * cq
Definition: test/core/fling/client.cc:37
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
server.h
gpr_time_from_seconds
GPRAPI gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type clock_type)
Definition: src/core/lib/gpr/time.cc:123
byte_buffer.h
timer
static uv_timer_t timer
Definition: test-callback-stack.c:34
grpc::testing::Client::DestroyMultithreading
virtual void DestroyMultithreading()=0
grpc::testing::Client::GetPollCount
virtual int GetPollCount()
Definition: client.h:237


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