- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Intel Intrinsics Guide 中,在几个 Intrinsics 的底部有“延迟和吞吐量信息”,列出了几个 CPUID 的性能。
例如,Intrinsics Guide 中的表格对于 Intrinsic _mm_hadd_pd
如下所示。 :
CPUID(s) Parameters Latency Throughput
0F_03 13 4
06_2A xmm1, xmm2 5 2
06_25/2C/1A/1E/1F/2E xmm1, xmm2 5 2
06_17/1D xmm1, xmm2 6 1
06_0F xmm1, xmm2 5 2
sudo dmidecode -t 4
还有小程序
cpuid
来自 Ubuntu 软件包,但它们的输出并不是很有用。
最佳答案
您可以使用 CPUID 指令获取该信息,其中
The extended family, bit positions 20 through 27 are used in conjunction with the family code, specified in bit positions 8 through 11, to indicate whether the processor belongs to the Intel386, Intel486, Pentium, Pentium Pro or Pentium 4 family of processors. P6 family processors include all processors based on the Pentium Pro processor architecture and have an extended family equal to 00h and a family code equal to 06h. Pentium 4 family processors include all processors based on the Intel NetBurst® microarchitecture and have an extended family equal to 00h and a family code equal to 0Fh.
The extended model specified in bit positi ons 16 through 19, in conjunction with the model number specified in bits 4 though 7 are used to identify the model of the processor within the processor’s family.
#include "stdio.h"
int main () {
int ebx = 0, ecx = 0, edx = 0, eax = 1;
__asm__ ("cpuid": "=b" (ebx), "=c" (ecx), "=d" (edx), "=a" (eax):"a" (eax));
int model = (eax & 0x0FF) >> 4;
int extended_model = (eax & 0xF0000) >> 12;
int family_code = (eax & 0xF00) >> 8;
int extended_family_code = (eax & 0xFF00000) >> 16;
printf ("%x %x %x %x \n", eax, ebx, ecx, edx);
printf ("CPUID: %02x %x\n", extended_family_code | family_code, extended_model | model);
return 0;
}
CPUID: 06_25
关于intrinsics - 确定 Intel Intrinsics Guide 中列出的 CPUID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15368394/
这是要修改的正确 Linux 内核代码吗?我如何进行更改以模拟 CPUID 代码以及我需要更改哪个函数。谢谢 #include #include #include #include #incl
我的CPU是Intel Core2Quad Q9300 2.5GHz。 CPU-Z 给我的值是 Family:6、Model:7 和 Stepping:7。尝试使用 EAX=1 的 cpuid 指令编
我在 Intel Vol.2 的多个指令条目中找到了推测数据缓存过程的描述。 例如,lfence : Processors are free to fetch and cache data specu
考虑到我正在使用 C++ 进行编码,如果可能的话,我想使用类似 Intrinsics 的解决方案来阅读有关硬件的有用信息,我的担忧/考虑是: 我对汇编不太了解,仅获取此类信息将是一笔可观的投资(虽然它
这里先给大家分享一个分配静态ip地址的代码 ? 1
cpuid用作序列化指令以在基准测试时防止 ooo 执行,因为基准测试指令的执行可能会在 rdtsc 之前重新排序如果单独使用。我的问题是以下说明是否仍然可行 rdtsc将在 cpuid 之间重新排序
有时我遇到用rdtsc指令读取TSC的代码,但是恰好在之前调用cpuid。 为什么需要调用cpuid?我意识到这可能与具有TSC值的不同内核有关,但是当您依次调用这两个指令时会发生什么呢? 最佳答案
我已经看到相关问题包括here和 here ,但似乎唯一提到的用于序列化 rdtsc 的指令是 cpuid。 不幸的是,cpuid 在我的系统上大约需要 1000 个周期,所以我想知道是否有人知道更便
我正在寻找一种巧妙的方法来捕获和摆弄 Linux 进程的 CPUID 指令。尝试使用 ptrace() 并修补进程创建的所有可执行 mmap 区域中的所有 cpuid 操作码,并用 int3 替换它们
CPUID 可用作序列化指令,如 here 所述和 here .在 C++ 中以这种方式使用它的最小/最简单的 asm 语法是什么? // Is that enough? // What to do
我正在尝试使用 C++ 中的 CPUID 访问信息。到目前为止,我已经制作了这段代码,不能再继续了。我在这里和网上找到了一些有用的文章,但它们似乎对我没有帮助。 我应该只使用 x88 的指令和寄存器。
我正在使用 CPUID 指令在我的操作系统中打印一些关于 CPU 的信息。 读取和打印供应商字符串(GenuineIntel)效果很好,但读取品牌字符串给我一些奇怪的字符串。 ok cpu-info
我正在尝试开发一个 C 函数来获取一些主板信息(名称、ID 等),但我找不到这些信息的存储位置。我查看了 CPUID,但在那里找不到与主板相关的任何信息(尽管有很多关于 CPU 的信息)。 有谁知道我
我正在为我的爱好操作系统开发 CPU 检测和一般环境检测代码。是否存在需要多次调用 CPUID 的情况?也就是说如果系统有多个核心,操作系统是否需要在每个核心上调用CPUID? NUMA 也是如此。
我正在尝试分析 x86-64 处理器上的代码执行时间。我指的是this英特尔白皮书并浏览了其他 SO 线程,讨论使用 RDTSCP 与 CPUID+RDTSC 的主题 here和 here . 在上述
我在较新的基于 i7 的计算机上遇到基于 CPUID 的代码的问题。它检测到 CPU 为具有 8 个 HT 单元的单核,而不是每个具有 2 个 HT 单元的 4 个核。 我一定是误解了从 CPU 返回
我正在尝试编译 C++ 代码。但我在 power8 架构上遇到错误。在 x86_64 架构中运行良好。以下是我遇到的错误。 error: impossible register constrain
如何以编程方式获取运行给定线程的核心?类似于 Unix 的 getcpuid。这适用于 Linux 和 C。 最佳答案 是否sched_getcpu()没有给你不同的核心值(value)? 关于c -
在为 Windows 编写新代码时,我偶然发现了来自 Windows API 的 _cpuinfo()。因为我主要处理 Linux 环境 (GCC),所以我想访问 CPUInfo。 我尝试了以下方法:
我正在做一些 Linux 内核计时,特别是在中断处理路径中。我一直在使用 RDTSC 进行计时,但我最近了解到它不一定准确,因为指令可能会乱序发生。 然后我尝试了: RDTSC + CPUID(此处为
我是一名优秀的程序员,十分优秀!