检测CPU的能力,而不总成 [英] Detecting CPU capability without assembly

查看:100
本文介绍了检测CPU的能力,而不总成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找方法,以确定CPU,它的能力(如SEE,SSE2,等等)。

I've been looking at ways to determine the CPU, and its capabilities (eg SEE,SSE2,etc).

但是所有的方法我发现使用CPUID指令涉及的组装code。由于在C做组装的不同方式/ C ++编译器,甚至目标(没有为VC下64位的目标内联汇编)之间,ID,而避免。

However all the ways I've found involved assembly code using the cpuid instruction. Given the differing ways of doing assembly in c/c++ between compilers and even targets (no inline assembly for 64bit targets under VC), id rather avoid that.

有没有一些简单的库周围,或OS功能(适用于Windows和Linux)获取这些信息?

Is there some simple library around, or OS functions (for both windows and linux) for getting this information?

目前我只用在x86和x86-64 CPU的平台感兴趣,而且我挑衅需要至少支持AMD和英特尔。

Currently I'm only interested in platforms using the x86 and x86-64 CPU's, and I defiantly need to support at least AMD and Intel.

推荐答案

编辑:起初,我用Google搜索libcpuid记忆与对等程序员谈话,谷歌搜索向我指出这个的 sourceforge的页面看起来较为陈旧。然后,我发现它是libcpu项目页面。

At first, I googled for "libcpuid" remembering a conversation with peer programmers, and the google search pointed me to this sourceforge page which looks quite outdated. Then I noticed it was the project page of "libcpu".

其实,真的有 libcpuid 可能会满足您的需求。

Actually, there really is a libcpuid that might suit your needs.


最后一次我看到这样的图书馆,我发现纵横交错。这是C ++虽然。

Last time I looked for such a library, I found crisscross. It's C++ though.

还有 geekinfo

但我不知道一个跨平台的库,只是没有CPUID。

But I don't know a cross-platform library that just does cpuid.

这篇关于检测CPU的能力,而不总成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆