aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-25 13:37:53 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-25 13:37:53 -0700
commitb7b20fee9649c57df0aef8cb54f85465312bab80 (patch)
treecc81fb2d27594454e17cb023355a71c3c456f224 /test/cpp/qps
parentf29d1f77999a911a1ef2f4255cb286f860ba74ca (diff)
parentbceec94ea4fc5f0085d81235d8e1c06798dc341a (diff)
Merge github.com:grpc/grpc into clang_fmt_upd
Diffstat (limited to 'test/cpp/qps')
-rw-r--r--test/cpp/qps/limit_cores.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/cpp/qps/limit_cores.cc b/test/cpp/qps/limit_cores.cc
index fad9a323af..59ed369067 100644
--- a/test/cpp/qps/limit_cores.cc
+++ b/test/cpp/qps/limit_cores.cc
@@ -37,14 +37,15 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-namespace grpc {
-namespace testing {
-
#ifdef GPR_CPU_LINUX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <sched.h>
+
+namespace grpc {
+namespace testing {
+
int LimitCores(const int* cores, int cores_size) {
const int num_cores = gpr_cpu_num_cores();
int cores_set = 0;
@@ -71,9 +72,16 @@ int LimitCores(const int* cores, int cores_size) {
CPU_FREE(cpup);
return cores_set;
}
+
+} // namespace testing
+} // namespace grpc
#else
+namespace grpc {
+namespace testing {
+
// LimitCores is not currently supported for non-Linux platforms
int LimitCores(const int*, int) { return gpr_cpu_num_cores(); }
-#endif
+
} // namespace testing
} // namespace grpc
+#endif