From owner-freebsd-hardware Fri Jul 6 13:47:18 2001 Delivered-To: freebsd-hardware@freebsd.org Received: from mass.dis.org (dhcp44-21.dis.org [216.240.44.21]) by hub.freebsd.org (Postfix) with ESMTP id 0E4C537B401; Fri, 6 Jul 2001 13:47:12 -0700 (PDT) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.4/8.11.3) with ESMTP id f66L0fa01267; Fri, 6 Jul 2001 14:00:41 -0700 (PDT) (envelope-from msmith@mass.dis.org) Message-Id: <200107062100.f66L0fa01267@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Peter Pentchev Cc: arch@FreeBSD.org, hardware@FreeBSD.org Subject: Re: New hw.cpuhz sysctl as per PR i386/27627 In-reply-to: Your message of "Fri, 06 Jul 2001 12:38:40 +0300." <20010706123840.A598@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 06 Jul 2001 14:00:41 -0700 From: Mike Smith Sender: owner-freebsd-hardware@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org CPU speeds aren't constants; this is probably not the right place to put it. It also assumes there's only one CPU, which isn't acceptable. It would be better to have a per-cpu "cupuinfo" struct, and populate it from a variety of sources. > Attached is a slight modification of the patch in PR i386/27627. > Are there any downsides to implementing this? If not, how should > it be extended to allow probing non-TSC/non-i386 timecounters? > > G'luck, > Peter > > -- > "yields falsehood, when appended to its quotation." yields falsehood, when ap > pended to its quotation. > > Index: src/sys/i386/isa/clock.c > =================================================================== > RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v > retrieving revision 1.174 > diff -u -r1.174 clock.c > --- src/sys/i386/isa/clock.c 2001/05/15 23:22:21 1.174 > +++ src/sys/i386/isa/clock.c 2001/07/06 09:11:52 > @@ -146,6 +146,10 @@ > static u_int32_t i8254_lastcount; > static u_int32_t i8254_offset; > static int i8254_ticked; > +static u_int cpuhz; > + > +SYSCTL_INT(_hw, OID_AUTO, cpuhz, CTLFLAG_RD, &cpuhz, 0, "CPU speed in Hz."); > + > /* > * XXX new_function and timer_func should not handle clockframes, but > * timer_func currently needs to hold hardclock to handle the > @@ -664,7 +668,7 @@ > * similar to those for the i8254 clock. > */ > if (tsc_present) > - tsc_freq = rdtsc() - old_tsc; > + cpuhz = tsc_freq = rdtsc() - old_tsc; > > if (bootverbose) { > if (tsc_present) > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hardware" in the body of the message -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hardware" in the body of the message