[PATCH] D38481: Use sched_getaffinity instead of std::thread::hardware_concurrency when available
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 18:07:57 PDT 2017
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/Fuzzer/FuzzerUtil.cpp:199-204
+ unsigned N = hardware_concurrency();
if (!N) {
- Printf("WARNING: std::thread::hardware_concurrency not well defined for "
+ Printf("WARNING: hardware_concurrency not well defined for "
"your platform. Assuming CPU count of 1.\n");
N = 1;
}
----------------
Since you are using your own hardware_concurrency, you don't need to guard against 0, no?
================
Comment at: tools/llvm-profdata/llvm-profdata.cpp:214-215
if (NumThreads == 0)
- NumThreads = std::max(1U, std::min(std::thread::hardware_concurrency(),
- unsigned(Inputs.size() / 2)));
+ NumThreads = std::max(
+ 1U, std::min(hardware_concurrency(), unsigned(Inputs.size() / 2)));
----------------
You can remove `std::max` because `std::min(hardware_concurrency(), unsigned(Inputs.size() / 2))` can now never return 0.
https://reviews.llvm.org/D38481
More information about the llvm-commits
mailing list