Date: Sat, 21 Jan 2006 18:27:34 -0800 From: Garrett Cooper <youshi10@u.washington.edu> To: freebsd-questions@freebsd.org Subject: Re: C/C++ call to detect cpu? Message-ID: <00CAD449-19D5-4CC2-9389-475E15E67AC6@u.washington.edu> In-Reply-To: <20060121203306.25121.qmail@simone.iecc.com> References: <20060121203306.25121.qmail@simone.iecc.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jan 21, 2006, at 12:33 PM, 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 As for gcc, CFLAGS and CXXFLAGS, doing some searching on google for "-march" gcc will prove to help you in finding out what is and is not supported by your processor. There's also a link from the Gentoo Linux docs somewhere in the handbook, but you will have to hunt that down on your own ;). There's also a better (or perhaps, just more relevant) doc somewhere on FreeBSD's site about CFLAGS and CXXFLAGS which also addresses gcc variables and architectures I think. -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00CAD449-19D5-4CC2-9389-475E15E67AC6>