OSDN Git Service

Bring r314809 back.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 4 Oct 2017 20:27:01 +0000 (20:27 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 4 Oct 2017 20:27:01 +0000 (20:27 +0000)
commita72e2a9037b131cd2d75215c228cc67359632ba7
tree29f2762cbc2c27a6441d5c8b3cbc21702a832b03
parentdfc9ea2a051b54e6445a41d434f383514067b727
Bring r314809 back.

But now include a check for CPU_COUNT so we still build on 10 year old
versions of glibc.

Original message:

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: https://llvm.org/svn/llvm-project/llvm/trunk@314931 91177308-0d34-0410-b5e6-96231b3b80d8
cmake/config-ix.cmake
include/llvm/Config/config.h.cmake
include/llvm/Support/ThreadPool.h
include/llvm/Support/Threading.h
lib/Support/Parallel.cpp
lib/Support/ThreadPool.cpp
lib/Support/Threading.cpp
tools/llvm-profdata/llvm-profdata.cpp