From 711766dc7553734ab239519ba30d3ca165b24874 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 21 Mar 2016 11:27:37 -0700 Subject: Ensure that no #includes are inside of a namespace. --- test/cpp/qps/limit_cores.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/cpp/qps/limit_cores.cc b/test/cpp/qps/limit_cores.cc index fad9a323af..c9931d9130 100644 --- a/test/cpp/qps/limit_cores.cc +++ b/test/cpp/qps/limit_cores.cc @@ -37,14 +37,15 @@ #include #include -namespace grpc { -namespace testing { - #ifdef GPR_CPU_LINUX #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include + +namespace grpc { +namespace testing { + int LimitCores(const int* cores, int cores_size) { const int num_cores = gpr_cpu_num_cores(); int cores_set = 0; @@ -72,6 +73,10 @@ int LimitCores(const int* cores, int cores_size) { return cores_set; } #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 -- cgit v1.2.3 From ca2886a05c85d634d324de6a5e359f34664d76b8 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 21 Mar 2016 12:04:18 -0700 Subject: Made the code simpler to parse for humans --- test/cpp/qps/limit_cores.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/cpp/qps/limit_cores.cc b/test/cpp/qps/limit_cores.cc index c9931d9130..59ed369067 100644 --- a/test/cpp/qps/limit_cores.cc +++ b/test/cpp/qps/limit_cores.cc @@ -72,13 +72,16 @@ int LimitCores(const int* cores, int cores_size) { CPU_FREE(cpup); return cores_set; } -#else +} // 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 -- cgit v1.2.3