C/C++ call to detect cpu?
Nicolas Blais
nb_root at videotron.ca
Sun Jan 22 15:51:11 PST 2006
On Saturday 21 January 2006 15:33, John Levine wrote:
> >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
> http://developer.intel.ru/design/xeon/applnots/241618.htm
>
> R's,
> John
Thanks, that was great help, I was able to get the Processor Name string using
info from that pdf. Using asm instead of sysctl will ensure a bit more
portability.
Unfortunatly, getting the actual processor speed (in Mhz) is more complicated
according to that pdf, would you have any suggestions?
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/20060122/08353ed4/attachment.bin
More information about the freebsd-questions
mailing list