Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 20:53:59 +0100
From:      Miguel Mendez <flynn@energyhq.homeip.net>
To:        Brooks Davis <brooks@one-eyed-alien.net>, hackers@freebsd.org
Subject:   Re: cpu info in userland
Message-ID:  <20020122195424.5C5523FC40@energyhq.homeip.net>
In-Reply-To: <20020122113351.A25927@Odin.AC.HMC.Edu>
References:  <20020122113351.A25927@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 22 January 2002 20:33, Brooks Davis wrote:

Hi.

> I'm trying to figure out how to get it from userland (in a shell script).
> I've looked at the cpuid port which seems to do most of it, but it
> doesn't display clock speed, only works on IA32 cpus, and won't be
> accurate if we have mismatched CPUs.[0]

Well, cpuid relies on the CPUID instruction to gather all that info from the 
processor. That's why it is x86 only. Unfortunately that opcode has no 
options to give info about cpu speed. You could roll your own code to do so, 
but I'm not sure you can messure cpu speed once multitasking/multiuser state 
is reached.

> Linux displays this information in /proc/cpuinfo though there's no
> consistancy between platforms (at least alpha and i386 seem to have
> nothing in common.)  Is there something similar I'm missing or is this a
> missing feature?

There are not sysctl variables that provide cpu speed afair, so that basicly 
means that you could:

	a) Fetch data from dmesg
	b) Require that linuxprocs is mounted (so you could cat 
/compat/linux/proc/cpuinfo)
	c) Roll your own code (don't know if possible at all)

Cheers,

-- 
        Miguel Mendez - flynn@energyhq.homeip.net
        EnergyHQ :: http://energyhq.homeip.net
        FreeBSD - The power to serve!

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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