C/C++ call to detect cpu?

Nicolas Blais nb_root at videotron.ca
Sat Jan 21 10:10:42 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)?

Portability is not really an issue (though I would be nice if it could run on 
BSD/linux systems).

For example, on one of my systems (from dmesg):
CPU: AMD Athlon(tm) 64 Processor 3000+ (2493.04-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x20ff0  Stepping = 0
  
Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
  Features2=0x1<SSE3>
  AMD Features=0xe2500800<SYSCALL,NX,MMX+,FFXSR,LM,3DNow+,3DNow>
  AMD Features2=0x1<LAHF>

I would need AMD Athlon(tm) 64 Processor 3000+ (2493.04-MHz 686-class CPU) or 
similar.

Thanks,
Nicolas.
-- 
FreeBSD 7.0-CURRENT #0: Sat Jan 21 11:33:22 EST 2006     
root at clk01a:/usr/obj/usr/src/sys/CLK01A 
PGP? (updated 16 Nov 05) : http://www.clkroot.net/security/nb_root.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20060121/5530fbe3/attachment.bin


More information about the freebsd-questions mailing list