aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support
diff options
context:
space:
mode:
authorGravatar zeliard <spacesun@naver.com>2015-04-30 18:02:06 +0900
committerGravatar zeliard <spacesun@naver.com>2015-04-30 18:02:06 +0900
commit06d64cda3cc215af965f518809a0f3b1ebcfc024 (patch)
tree0dbbb5086b2977eb9a1a0b7917e27d26121c4e64 /src/core/support
parent3874ad0833d670d73db88a7afd65145ff2c0f2ae (diff)
implement gpr_cpu_num_cores() and gpr_cpu_current_cpu() on Windows
Diffstat (limited to 'src/core/support')
-rw-r--r--src/core/support/cpu_windows.c12
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..4f7103d282 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 */