From owner-freebsd-questions@FreeBSD.ORG Sun Jan 22 02:26:28 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 87CEC16A420 for ; Sun, 22 Jan 2006 02:26:28 +0000 (GMT) (envelope-from youshi10@u.washington.edu) Received: from mxout2.cac.washington.edu (mxout2.cac.washington.edu [140.142.33.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2460A43D45 for ; Sun, 22 Jan 2006 02:26:28 +0000 (GMT) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout2.cac.washington.edu (8.13.5+UW05.10/8.13.5+UW05.09) with ESMTP id k0M2QR1U027116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 21 Jan 2006 18:26:27 -0800 X-Auth-Received: from [192.168.0.23] (dsl254-013-145.sea1.dsl.speakeasy.net [216.254.13.145]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.5+UW05.10/8.13.5+UW05.09) with ESMTP id k0M2QR23008666 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 21 Jan 2006 18:26:27 -0800 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <20060121203306.25121.qmail@simone.iecc.com> References: <20060121203306.25121.qmail@simone.iecc.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <00CAD449-19D5-4CC2-9389-475E15E67AC6@u.washington.edu> Content-Transfer-Encoding: 7bit From: Garrett Cooper Date: Sat, 21 Jan 2006 18:27:34 -0800 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.746.2) X-Uwash-Spam: Gauge=XIIIIIIII, Probability=18%, Report='ADULT_MED_HI_1 2, __ADULT_ANY 0, __ADULT_PHRASE_5_MED 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0' Subject: Re: C/C++ call to detect cpu? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2006 02:26:28 -0000 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