Use sched_getaffinity instead of std::thread::hardware_concurrency.

The issue with std::thread::hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.

With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.

This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.

git-svn-id: svn://svn.chromium.org/llvm-project/llvm/trunk/lib/Fuzzer@314809 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/FuzzerUtil.cpp b/FuzzerUtil.cpp
index f5a7773..5f76ddc 100644
--- a/FuzzerUtil.cpp
+++ b/FuzzerUtil.cpp
@@ -195,15 +195,7 @@
     Printf(FallbackFMT, PC);
 }
 
-unsigned NumberOfCpuCores() {
-  unsigned N = std::thread::hardware_concurrency();
-  if (!N) {
-    Printf("WARNING: std::thread::hardware_concurrency not well defined for "
-           "your platform. Assuming CPU count of 1.\n");
-    N = 1;
-  }
-  return N;
-}
+unsigned NumberOfCpuCores() { return hardware_concurrency(); }
 
 size_t SimpleFastHash(const uint8_t *Data, size_t Size) {
   size_t Res = 0;