From owner-freebsd-questions@FreeBSD.ORG Sun Jan 22 23:51:11 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 A8D9716A42F for ; Sun, 22 Jan 2006 23:51:09 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D36243D5A for ; Sun, 22 Jan 2006 23:51:08 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from clk01a ([66.130.198.54]) by VL-MH-MR001.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0ITI00CE7Q982Q90@VL-MH-MR001.ip.videotron.ca> for freebsd-questions@freebsd.org; Sun, 22 Jan 2006 18:51:08 -0500 (EST) Date: Sun, 22 Jan 2006 18:50:49 -0500 From: Nicolas Blais In-reply-to: <20060121203306.25121.qmail@simone.iecc.com> To: freebsd-questions@freebsd.org Message-id: <200601221851.03015.nb_root@videotron.ca> MIME-version: 1.0 Content-type: multipart/signed; boundary=nextPart2088378.0Z61S7Fe31; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-transfer-encoding: 7bit References: <20060121203306.25121.qmail@simone.iecc.com> User-Agent: KMail/1.9.1 Cc: John Levine 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 23:51:11 -0000 --nextPart2088378.0Z61S7Fe31 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 us= ing=20 info from that pdf. Using asm instead of sysctl will ensure a bit more=20 portability. =20 Unfortunatly, getting the actual processor speed (in Mhz) is more complicat= ed=20 according to that pdf, would you have any suggestions? Thanks, Nicolas. =2D-=20 =46reeBSD 7.0-CURRENT #0: Sat Jan 21 11:33:22 EST 2006 =20 root@clk01a:/usr/obj/usr/src/sys/CLK01A=20 PGP? (updated 16 Nov 05) : http://www.clkroot.net/security/nb_root.asc --nextPart2088378.0Z61S7Fe31 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQBD1Bpm4wTBlvcsbJURAiwaAKCCamY2AgMklD8CWJ023Wo3sl1anACdGuT4 jVYYw9+IFiQi1Bbg20+UXM0= =UMr4 -----END PGP SIGNATURE----- --nextPart2088378.0Z61S7Fe31--