CPUInfo, an open source multiplatform library for determining CPU features

A while ago, I started on my CPUInfo project at http://cpuinfo.sourceforge.net/. The goal is to provide developers with an easy way to determine (at runtime) what kind of CPU their code is running on. By knowing about things like cache sizes, cache configurations, clockspeed, number of cores, and what kind of instructionset extensions are supported, the most optimal codepath can be chosen.

As an example of how to use this library, I’ve also made a start with a test application, which is intended to more or less copy the look and functionality of utilities such as CPU-Z.


CPU-Z is built on the CPUID library, which is a nice and powerful tool, but licensing it costs a great deal, and as such is not very interesting for hobby projects or free/open source applications. The intention of this project is to give the free/open source world a free/open source alternative.

Currently the library only supports x86 processors, and the test application only works on Windows (both 32-bit and 64-bit versions are available). Most, if not all of the library should be portable to other OSes, as long as they use an x86 processor as well. The goal is to at least make the library work with gcc as well, under OSes such as linux, FreeBSD and OS X, which all mainly use x86 processors. For these platforms, an alternative test application will be available (which will probably at least be portable between these OSes, via the use of the common X Window System).

Since it is a community project, everyone is free and encouraged to add to and extend the codebase to support their CPUs as well, even if these aren’t x86-compatible ones. I believe that this project suits the community model very well, as it is very difficult for a single developer to get access to the vast majority of CPUs out there. This way, I have set up a framework providing the basis for the library, and as soon as someone notices an incompatibility with their CPU, or features that the library cannot yet detect, they can add this themselves, or at least provide feedback, so that we can try to find a proper solution together.

This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to CPUInfo, an open source multiplatform library for determining CPU features

  1. Pingback: Why I don’t use linux (and why you shouldn’t either) | Scali's blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s