diff options
author | lyuxuan <yuxuanli@google.com> | 2017-01-11 23:36:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-11 23:36:52 -0800 |
commit | 3cdf729eb07b60cd635aadb91718ee54a2f0e808 (patch) | |
tree | 9c91f36ccc069235023b7c7b8041296ddcb7b9f6 /test | |
parent | 21b6a6805a9a2c1699a7aae52aff3a3bac94022a (diff) | |
parent | 98c0bd7c829c4932ac12ebbe6687f0fc5380e866 (diff) |
Merge pull request #8770 from lyuxuan/channel_args1
configurable channel args for performance benchmarking
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/qps/client.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index fdd78ebb89..18f9778fc6 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -409,6 +409,7 @@ class ClientImpl : public Client { // old compilers happy with using this in std::vector ChannelArguments args; args.SetInt("shard_to_ensure_no_subchannel_merges", shard); + set_channel_args(config, &args); channel_ = CreateTestChannel( target, config.security_params().server_host_override(), config.has_security_params(), !config.security_params().use_test_ca(), @@ -423,6 +424,18 @@ class ClientImpl : public Client { StubType* get_stub() { return stub_.get(); } private: + void set_channel_args(const ClientConfig& config, ChannelArguments* args) { + for (auto channel_arg : config.channel_args()) { + if (channel_arg.value_case() == ChannelArg::kStrValue) { + args->SetString(channel_arg.name(), channel_arg.str_value()); + } else if (channel_arg.value_case() == ChannelArg::kIntValue) { + args->SetInt(channel_arg.name(), channel_arg.int_value()); + } else { + gpr_log(GPR_ERROR, "Empty channel arg value."); + } + } + } + std::shared_ptr<Channel> channel_; std::unique_ptr<StubType> stub_; }; |