strace.ebpf icon indicating copy to clipboard operation
strace.ebpf copied to clipboard

Replace sysconf() with sched_getaffinity()

Open vitalyvch opened this issue 7 years ago • 0 comments

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.

vitalyvch avatar Mar 15 '17 15:03 vitalyvch