aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/qps/server.h')
-rw-r--r--test/cpp/qps/server.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index 196fdac8f3..94a6f8acfa 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -34,14 +34,16 @@
#ifndef TEST_QPS_SERVER_H
#define TEST_QPS_SERVER_H
-#include <grpc/support/cpu.h>
#include <grpc++/security/server_credentials.h>
+#include <grpc/support/cpu.h>
+#include <vector>
+#include "src/proto/grpc/testing/control.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
+#include "test/cpp/qps/limit_cores.h"
#include "test/cpp/qps/timer.h"
-#include "src/proto/grpc/testing/messages.grpc.pb.h"
-#include "src/proto/grpc/testing/control.grpc.pb.h"
namespace grpc {
namespace testing {
@@ -49,8 +51,10 @@ namespace testing {
class Server {
public:
explicit Server(const ServerConfig& config) : timer_(new Timer) {
+ cores_ = LimitCores(config.core_list().data(), config.core_list_size());
if (config.port()) {
port_ = config.port();
+
} else {
port_ = grpc_pick_unused_port_or_die();
}
@@ -86,7 +90,7 @@ class Server {
}
int port() const { return port_; }
- int cores() const { return gpr_cpu_num_cores(); }
+ int cores() const { return cores_; }
static std::shared_ptr<ServerCredentials> CreateServerCredentials(
const ServerConfig& config) {
if (config.has_security_params()) {
@@ -103,6 +107,7 @@ class Server {
private:
int port_;
+ int cores_;
std::unique_ptr<Timer> timer_;
};