Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Apr 2003 00:01:50 -0700
From:      Wes Peters <wes@softweyr.com>
To:        Bruce Evans <bde@zeta.org.au>, Wes Peters <wes@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/i386/i386 identcpu.c
Message-ID:  <200304110001.50201.wes@softweyr.com>
In-Reply-To: <20030410204421.A3151@gamplex.bde.org>
References:  <200304100705.h3A75OVW019701@repoman.freebsd.org> <20030410204421.A3151@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 10 April 2003 04:20, Bruce Evans wrote:
> On Thu, 10 Apr 2003, Wes Peters wrote:
> > wes         2003/04/10 00:05:24 PDT
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sys/i386/i386        identcpu.c
> >   Log:
> >   Add a sysctl that records and reports the CPU clock rate calculated
> >   at boot.  Funny how often this trivial piece of information crops
> > up in embedded boxen.
> >
> >   Sponsored by:   St. Bernard Software
> >
> >   Revision  Changes    Path
> >   1.121     +6 -0      src/sys/i386/i386/identcpu.c
>
> What's wrong with the existing sysctl (machdep.tsc_freq)?  It is
> machine dependent, but no more than the new sysctl (both only work for
> certain i386's with TSC's).

This control works across all "i386" processors you can buy today, and 
will also work across several other FreeBSD architectures as soon as I 
get my hands on the boxen required.  The sparc64 is on its way; ia64 and 
x86-64 will follow later.  Maybe much later.

> It doesn't discard up to 6 digits of
> precision. It reports the current frequency, which should be the actual
> frequency, which should differ from the frequency determined at boot
> time since it is difficult to determine the actual frequency at boot
> time without making the boot too long.

My need, now spanning 3 different companies and product lines, is more to 
determine a few broad classifications of hardware.  If the numbers differ 
by more than 10, that would suffice, but in practice the expected numbers 
are 400, 550, 1130 (or maybe 1260) and 2400.  Those are far enough apart 
to make even imprecise people like me believe I can tell the difference.

I am well aware that the boot-time numbers on some hardware might differ 
wildly from the run-time numbers; my laptop boots at 75 MHz and switches 
up to 300 MHz as needed.  That's not an issue in any of the 3 
implementations that have asked for this.

> Apr  9 20:08:28 besplex kernel: Timecounter "TSC"  frequency 1532823868
> Hz Apr  9 20:08:28 besplex kernel: CPU: AMD Athlon(TM) XP1600+
> (1532.82-MHz 686-class CPU)
>
> The first line of this is only printed if the TSC is attached to a
> timecounter, which is in most !SMP && !APM cases.  The second line
> prints the value that is returned by the new sysctl, except it doesn't
> return the fractional part and has rounding bugs.

And yet still suffices for the each of the different teams who have asked 
for it.  A more complex, more accurate answer isn't better for their 
need, it's just more complex.

-- 

        Where am I, and what am I doing in this handbasket?

Wes Peters                                               wes@softweyr.com



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