[Support] Fix computeHostNumPhysicalCores() to respect affinity
authorFangrui Song <maskray@google.com>
Fri, 31 Jul 2020 18:20:15 +0000 (11:20 -0700)
committerFangrui Song <maskray@google.com>
Fri, 31 Jul 2020 18:20:15 +0000 (11:20 -0700)
commitcd53ded557c3487b8dae2f9de894fdb5b75cb8c8
treec452004293f39e68ce1233fa8a5deffc6d36c32d
parent8830f1170dae898d7a0d6a95897e1c23e316ec1e
[Support] Fix computeHostNumPhysicalCores() to respect affinity

computeHostNumPhysicalCores() is designed to respect CPU affinity.
D84764 used sysconf(_SC_NPROCESSORS_ONLN) which does not respect
affinity.
SupportTests Threading.PhysicalConcurrency may fail if taskset -c is specified.
llvm/lib/Support/Host.cpp