Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2006 18:50:49 -0500
From:      Nicolas Blais <nb_root@videotron.ca>
To:        freebsd-questions@freebsd.org
Cc:        John Levine <johnl@iecc.com>
Subject:   Re: C/C++ call to detect cpu?
Message-ID:  <200601221851.03015.nb_root@videotron.ca>
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
--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601221851.03015.nb_root>