8179882abb
There were a lot of instances where there was additional code written to detect certain features from the brand string (e.g., does it have "Core (TM)"? if it has, does it have "i3"?). It makes sense to only write code for detecting these features in isolation, preventing the exponential blowup of possible intel_code_t values (e.g. previously there were enum values for CORE_{,IVY,HASWELL,BROADWELL,SKYLAKE}{,M}{3,5,7} - almost 20 separate enums items; these can now be expressed with the respective bits (CORE_, _I_, _M_, _3, _5 and _7). The change in matchtables is the addition of an extra field after brand_code: it is called model_bits. The bits for each vendor is defined in the beginning of recog_<<vendor>>.c This is the first part of the overhaul, which handles the bits detection and proper matchtables for Intel. Refactoring of AMD detection code coming next... |
||
---|---|---|
contrib/MSR Driver | ||
cpuid_tool | ||
debian | ||
libcpuid | ||
tests | ||
.gitignore | ||
AUTHORS | ||
ChangeLog | ||
configure.ac | ||
COPYING | ||
libcpuid.dsw | ||
libcpuid.pc.in | ||
libcpuid_vc10.sln | ||
libcpuid_vc71.sln | ||
Makefile.am | ||
NEWS | ||
README | ||
Readme.md |
libcpuid
libcpuid provides CPU identification for the x86 (and x86_64). For details about the programming API, you might want to take a look at the project's website on sourceforge (http://libcpuid.sourceforge.net/). There you'd find a short tutorial, as well as the full API reference.
Configuring after checkout
Under linux, where you download the sources, there's no configure script to run. This is because it isn't a good practice to keep such scripts in a source control system. To create it, you need to run the following commands once, after you checkout the libcpuid sources from github:
1. run "libtoolize"
2. run "autoreconf --install"
You need to have autoconf
, automake
and libtool
installed.
After that you can run ./configure
and make
- this will build
the library.
make dist
will create a tarball (with "configure" inside) with the
sources.
Testing
After any change to the detection routines or match tables, it's always
a good idea to run make test
. If some test fails, and you're confident
that the test is wrong and needs fixing, run make fix-tests
.
You can also add a new test (which is basically a file containing
the raw CPUID data and the expected decoded items) by using
tests/create_test.py
. The workflow there is as follows:
- Run "cpuid_tool" with no arguments. It will tell you that it has written a pair of files, raw.txt and report.txt. Ensure that report.txt contains meaningful data.
- Run "tests/create_test.py raw.txt report.txt > «my-cpu».test"
- Use a proper descriptive name for the test (look into tests/amd and tests/intel to get an idea) and copy your test file to an appropriate place within the tests directory hierarchy.
For non-developers, who still want to contribute tests for the project, use this page to report misdetections or new CPUs that libcpuid doesn't handle well yet.
Users
So far, I'm aware of the following projects which utilize libcpuid:
- CPU-X (https://github.com/X0rg/CPU-X)
- fre:ac (https://www.freac.org/)
- ucbench (http://anrieff.net/ucbench)
We'd love to hear from you if you are also using libcpuid and want your project listed above.