gitee.com/quant1x/gox@v1.21.2/devices/cpu_id_test.go (about) 1 package devices 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 // 9 //import ( 10 // "encoding/binary" 11 // "fmt" 12 // "gitee.com/quant1x/gox/api" 13 // "testing" 14 //) 15 // 16 //func Test_asmCpuid(t *testing.T) { 17 // cpuId, err := CpuPhysicalID() 18 // fmt.Println(api.String2Bytes(cpuId), err) 19 // a, b, c, d := asmCpuid(3) 20 // fmt.Printf("%08x %08x %08x %08x\n", a, b, c, d) 21 // a, b, c, d = asmCpuidex(1, 1) 22 // fmt.Printf("%08x %08x %08x %08x\n", a, b, c, d) 23 // data := []byte{} 24 // data = binary.LittleEndian.AppendUint32(data, d) 25 // data = binary.LittleEndian.AppendUint32(data, a) 26 // fmt.Printf("%s\n", api.Bytes2String(data)) 27 //} 28 29 func TestCpuPhysicalID(t *testing.T) { 30 cpuId, err := CpuPhysicalID() 31 fmt.Println(cpuId, err) 32 }