github.com/loov/hrtime@v1.0.3/tsc_amd64.go (about)

     1  package hrtime
     2  
     3  func rdtscpAsm() uint64
     4  func rdtscAsm() uint64
     5  func cpuidAsm(op1, op2 uint32) (eax, ebx, ecx, edx uint32)
     6  
     7  func initCPU() {
     8  	cpuid = cpuidAsm
     9  }
    10  
    11  // RDTSCP returns Read Time-Stamp Counter value using RDTSCP asm instruction.
    12  //
    13  // If a platform doesn't support the instruction it returns 0.
    14  // Use TSCSupported to check.
    15  func RDTSCP() uint64 { return rdtscpAsm() }
    16  
    17  // RDTSC returns Read Time-Stamp Counter value using RDTSC asm instruction.
    18  //
    19  // If a platform doesn't support the instruction it returns 0.
    20  // Use TSCSupported to check.
    21  func RDTSC() uint64 { return rdtscAsm() }