本文介绍了有没有比cpuid更便宜的序列化指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了相关的问题,包括此处和,但似乎唯一提到的用于序列化rdtsc的指令是cpuid.

I have seen the related question including here and here, but it seems that the only instruction ever mentioned for serializing rdtsc is cpuid.

不幸的是,cpuid在我的系统上花费了大约1000个周期,所以我想知道是否有人知道更便宜的(更少的周期并且没有对内存的读写操作)序列化指令吗?

Unfortunately, cpuid takes roughly 1000 cycles on my system, so I am wondering if anyone knows of a cheaper (fewer cycles and no read or write to memory) serializing instruction?

我看着iret,但这似乎改变了控制流程,这也是不可取的.

I looked at iret, but that seems to change control flow, which is also undesirable.

我实际上看过Alex关于rstscp的答案中链接的白皮书,但它说:

I have actually looked at the whitespaper linked in Alex's answer about rstscp, but it says:

第二点似乎使它不理想.

That second point seems to be make it less than ideal.

推荐答案

您是否看过rdtscp指令?这是rdtsc的读取序列化版本.

Have you looked at the rdtscp instruction? This is the read serialized version of rdtsc.

对于基准测试,我建议阅读.它提供了一些测量时钟滴答的最佳实践.

For benchmarking I would recommend to read this whitepaper. It provides a couple of best practices for measuring clock ticks.

亚历克斯(英特尔)

这篇关于有没有比cpuid更便宜的序列化指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 00:38