Open vitalyvch opened 7 years ago
replace sysconf() with sched_getaffinity(). It allows to ignore non-actual CPUs.
example:
//... cpu_set_t set; sched_getaffinity(0, sizeof(cpu_set_t), &set) long cpu_qty = CPU_COUNT(&set); //...
Existing solution will have problems with off-line CPUs, and CPUs in PWR-OFF C-state.
replace sysconf() with sched_getaffinity(). It allows to ignore non-actual CPUs.
example:
Existing solution will have problems with off-line CPUs, and CPUs in PWR-OFF C-state.