Rdcycle指令获取数据不准确

1.执行指令
asm volatile(
“rdcycle %0\n”
: “=r” (cycle)
:: “memory”);
2.执行结果
cycle:0x000000044e7d41f0
cycle:0x000000044ea31450
cycle:0x000000044ec8e6ae
cycle:0x000000044eeeb90c
cycle:0x000000044f148b80
cycle:0x000000044f3a5dde
cycle:0x000000044f603066
cycle:0x000000044f8602c6
cycle:0x000000044fabd524
cycle:0x000000044fd1a640
cycle:0x000000044ff7789e
cycle:0x00000004501d4b12
cycle:0x0000000450431d70
cycle:0x000000045068eff6
cycle:0x00000004508ec256
cycle:0x0000000450b494b4
cycle:0x0000000450da6714
cycle:0x0000000451003972
cycle:0x0000000451260be4
cycle:0x00000004514bde46
cycle:0x000000045171af88
cycle:0x00000004519781e8
cycle:0x0000000451bd5446
cycle:0x0000000451e326a4
cycle:0x000000045208f904
cycle:0x00000004522ecb76
cycle:0x0000000452549dd6
cycle:0x00000004527a705e
cycle:0x0000000452a042bc
cycle:0x0000000452c6151a
cycle:0x0000000452ebe77a
cycle:0x000000045311b9d8
cycle:0x0000000453378b08
cycle:0x00000004535d5d68
cycle:0x0000000453832ff0
cycle:0x0000000453a9024e
cycle:0x0000000453ced4ac
cycle:0x0000000453f4a70c
cycle:0x00000004541a796a
cycle:0x0000000454404bde
cycle:0x0000000454661e3c
cycle:0x00000004548bf0c4
cycle:0x0000000454b1c1e0
cycle:0x0000000454d7943e
cycle:0x0000000454fd669e
cycle:0x00000004552338fc
cycle:0x0000000455490b70
cycle:0x00000004556eddce
cycle:0x000000045594b040
cycle:0x0000000455ba82a0
cycle:0x0000000455e054fe
cycle:0x000000045606275e
cycle:0x00000004562bf9bc
cycle:0x000000045651cc30

不知道你所谓不准确是什么意思。如果你是间隔一段时间读取的话,没看出有什么问题

这个指令是获取体统时钟周期的,是一个固定的值,不应该是变化的呀?

错了,cycle就是目前的的时钟周期,当然会随着时间而增长