sched_getcpu()
call returns virtual CPU number. Mapping of virtual CPU to real CPU info is in /proc/cpuinfo.
If your system supports VDSO, then sched_getcpu()
is relatively fast.
CPU number can be also obtained using CPUID
instruction, but it is slower than sched_getcpu()
.