C/C++ call to detect cpu?

John Levine johnl at iecc.com
Sat Jan 21 12:33:05 PST 2006

>Other than 'grep'ing dmesg, is there a way to know the current cpu such as a 
>struct with the machine's cpu and cpu feature (kinda like a time_t struct)?

$ sysctl hw.model
hw.model: AMD Athlon(tm) 64 Processor 3000+

If you want more details write a tiny assembler routine that does a
CPUID instruction and decode the result.  Intel has a detailed application
note about it at


More information about the freebsd-questions mailing list