收集有关x86 CPU的信息
x86cpu的Python项目详细描述
使用cpuid指令获取 关于CPU的信息。
查询OS as well as cpuid 查看os/cpu是否支持avx指令。
快速启动
>>> from x86cpu import info >>> print(info.model_display, info.family_display) (69, 6) >>> print(info.vendor) GenuineIntel >>> print(info.brand) 'Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz'
您可以直接运行cpuid命令。cpuid的参数变为 在调用cpuid指令之前进入EAX寄存器:
>>> from x86cpu import cpuid >>> cpuid(1) {'eax': 263761L, 'ebx': 17827840L, 'ecx': 2147154879L, 'edx': 3219913727L}
一些cpuid命令还关心ECX寄存器中的值。你 可以使用第二个可选参数将其设置为cpuid:
>>> cpuid(13, 1) {'eax': 1, 'ebx': 0, 'ecx': 0, 'edx': 0}
该包安装一个命令行工具x86report,提供如下输出 这个:
$ x86report x86cpu report ------------- brand : Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz vendor : GenuineIntel model (display) : 69 family (display) : 6 model : 5 family : 6 extended model : 4 extended family : 0 stepping : 1 processor type : 0 signature : 263761 MMX : True 3DNow! : True SSE : True SSE2 : True SSE3 : True SSSE3 : True SSE4.1 : True SSE4.2 : True supports AVX : True supports AVX2 : True
代码
见https://github.com/matthew-brett/x86cpu
在bsd two子句许可下发布-请参见 来源分布。
最新发布的版本位于https://pypi.python.org/pypi/x86cpu
支架
请在x86cpu issue tracker上提出问题。