Home Benchmarks Software Miscellaneous

cpuid

A very simple C abstraction to common cpuid feature flags. Every single time I've implemented dynamic CPU feature dispatch that relies on optional processor feature extensions or basic processor-specific variables I've had to write up yet another cpuid abstraction layer (meaning I've had to refer back again to the manuals). The cpuid package provided here is meant to be a very simple feature detection interface that you can easily integrate into your project. Just copy in cpuid.h and cpuid.c. Please see cpuid.h for additional documentation. Please see tool.c for a very simple example program.

Download

cpuid-0.2.tar.gz

License

Simplified BSD License

Example

nehalem:cpuid sbahra$ make
gcc -I. -std=c99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization
-fstrict-aliasing -O2 -pipe -Wno-parentheses -o cpuid cpuid.c tool.c
nehalem:cpuid sbahra$ ./cpuid -b
Intel(R) Core(TM) i3 CPU         540  @ 3.07GHz
nehalem:cpuid sbahra$ ./cpuid -f
FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH 
DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 DTES64 MONITOR DSCPL VMX EST TM2 
SSSE3 CMPXCHG16B XTPR PDCM PCID SSE4.1 SSE4.2 POPCNT RDTSCP NX SYSCALL X86_64 
© 2007 - 2016 Samy Al Bahra.