strace.ebpf
strace.ebpf copied to clipboard
Replace sysconf() with sched_getaffinity()
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.