[Runtime] use pthread_getaffinity_np to determine default worker count
- Jul 05, 2021
-
-
Florian Fischer authored
The value reported by std::thread::hardware_concurrency() can be more than the available CPUs to the current process for example if EMPER runs in a container or qemu. GNU nproc(1) does the right thing and we can take inspiration from them. The solution is to use pthread_getaffinity_np which fills a CPU set with all CPU a pthread can be scheduled on. We use this more precise CPU count if possible.
-