github.com/lrita/numa@v1.0.2/numa_linux_amd64.go (about)

     1  package numa
     2  
     3  import (
     4  	"github.com/intel-go/cpuid"
     5  )
     6  
     7  var fastway = cpuid.HasFeature(cpuid.RDTSCP)
     8  
     9  func getcpu()
    10  
    11  // GetCPUAndNode returns the node id and cpu id which current caller running on.
    12  // https://man7.org/linux/man-pages/man2/getcpu.2.html
    13  //
    14  // equal:
    15  //
    16  // if fastway {
    17  // 	call RDTSCP
    18  //  The linux kernel will fill the node cpu id in the private data of each cpu.
    19  //  arch/x86/kernel/vsyscall_64.c@vsyscall_set_cpu
    20  // }
    21  // call vdsoGetCPU
    22  func GetCPUAndNode() (cpu int, node int)