diff options
author | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-04-30 19:28:20 -0700 |
---|---|---|
committer | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-04-30 19:28:20 -0700 |
commit | 6e5bad3f3dcd7d1666c89ae17d22b9ad78e5a9cc (patch) | |
tree | a856cd215f7a16b5030b1c29a53672ec1bea9713 | |
parent | 70e299f2ebe052bc3b17c4422f0b81380b0b7858 (diff) | |
parent | 81b67112b8616d8fc5fdb64e2f4a3d57159a23cd (diff) |
Merge pull request #1421 from zeliard/master
implement gpr_cpu_num_cores() and gpr_cpu_current_cpu() on Windows
-rw-r--r-- | src/core/support/cpu_windows.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c index cb454ccd3b..f56bab3f8b 100644 --- a/src/core/support/cpu_windows.c +++ b/src/core/support/cpu_windows.c @@ -34,19 +34,17 @@ #include <grpc/support/port_platform.h> #ifdef GPR_WIN32 - +#include <windows.h> #include <grpc/support/log.h> unsigned gpr_cpu_num_cores(void) { - /* TODO(jtattermusch): implement */ - gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1"); - return 1; + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwNumberOfProcessors; } unsigned gpr_cpu_current_cpu(void) { - /* TODO(jtattermusch): implement */ - gpr_log(GPR_ERROR, "Cannot determine current CPU"); - return 0; + return GetCurrentProcessorNumber(); } #endif /* GPR_WIN32 */ |