github.com/loov/hrtime@v1.0.3/tsc_internal_test.go (about) 1 package hrtime 2 3 import ( 4 "testing" 5 ) 6 7 func BenchmarkRDTSCP(b *testing.B) { 8 if !TSCSupported() { 9 b.Skip("Cycle counting not supported") 10 } 11 12 for i := 0; i < b.N; i++ { 13 RDTSCP() 14 } 15 } 16 17 func BenchmarkRDTSC(b *testing.B) { 18 if !TSCSupported() { 19 b.Skip("Cycle counting not supported") 20 } 21 for i := 0; i < b.N; i++ { 22 RDTSC() 23 } 24 }