I have tried sysconf(_SC_NPROCESSORS_ONLN)
and sysconf(_SC_NPROCESSORS_CONF)
, but they both return total number of (as Intel calls it in their CPU documentation) Threads (as in: hyper-threading threads), not physical cores (called Core on mentioned Intel site).
Is there a way to get number of physical cores, instead of logical? Counting entries in /proc/cpuinfo
gives 8, similarly to calling sysconf
, and my processor is the one linked above.
I'm interested in answers working on Linux and BSDs, preferably in form of C API.