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()
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…