aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-07-06 09:22:10 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-07-06 09:22:10 -0700
commit873ee82277869e91a7ac17b555c3d98b317f6878 (patch)
tree3d21dc4cfaf2b4f8c6a65b9f2c83c2a913fc6773 /test/cpp/qps/server.h
parenta1a3f363ee0309bdfbcdf919ab57468e3522731a (diff)
Add channel args to qps server
Diffstat (limited to 'test/cpp/qps/server.h')
-rw-r--r--test/cpp/qps/server.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index a3b4d7d241..4b699e0708 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -19,8 +19,11 @@
#ifndef TEST_QPS_SERVER_H
#define TEST_QPS_SERVER_H
+#include <grpc++/resource_quota.h>
#include <grpc++/security/server_credentials.h>
+#include <grpc++/server_builder.h>
#include <grpc/support/cpu.h>
+#include <grpc/support/log.h>
#include <vector>
#include "src/core/lib/surface/completion_queue.h"
@@ -102,6 +105,31 @@ class Server {
return 0;
}
+ protected:
+ static void ApplyConfigToBuilder(const ServerConfig& config,
+ ServerBuilder* builder) {
+ if (config.resource_quota_size() > 0) {
+ builder->SetResourceQuota(ResourceQuota("AsyncQpsServerTest")
+ .Resize(config.resource_quota_size()));
+ }
+ for (const auto& channel_arg : config.channel_args()) {
+ switch (channel_arg.value_case()) {
+ case ChannelArg::kStrValue:
+ builder->AddChannelArgument(channel_arg.name(),
+ channel_arg.str_value());
+ break;
+ case ChannelArg::kIntValue:
+ builder->AddChannelArgument(channel_arg.name(),
+ channel_arg.int_value());
+ break;
+ case ChannelArg::VALUE_NOT_SET:
+ gpr_log(GPR_ERROR, "Channel arg '%s' does not have a value",
+ channel_arg.name().c_str());
+ break;
+ }
+ }
+ }
+
private:
int port_;
int cores_;