[PATCH] D42547: [sanitizer] Implement GetNumberOfCPUs for Windows

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 09:29:20 PST 2018


cryptoad created this revision.
cryptoad added a reviewer: rnk.
Herald added subscribers: Sanitizers, delcypher, kubamracek.

Implement `GetNumberOfCPUs` using `GetNativeSystemInfo`.
The only consummer of this function is Scudo which is not functional on
Windows yet.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42547

Files:
  lib/sanitizer_common/sanitizer_win.cc


Index: lib/sanitizer_common/sanitizer_win.cc
===================================================================
--- lib/sanitizer_common/sanitizer_win.cc
+++ lib/sanitizer_common/sanitizer_win.cc
@@ -1106,9 +1106,10 @@
   UNIMPLEMENTED();
 }
 
-// FIXME: implement on this platform.
 u32 GetNumberOfCPUs() {
-  UNIMPLEMENTED();
+  SYSTEM_INFO sysinfo = {0};
+  GetNativeSystemInfo(&sysinfo);
+  return sysinfo.dwNumberOfProcessors;
 }
 
 }  // namespace __sanitizer


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42547.131469.patch
Type: text/x-patch
Size: 467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/addd0b52/attachment.bin>


More information about the llvm-commits mailing list