From owner-freebsd-arch Fri Jul 6 2:34:41 2001 Delivered-To: freebsd-arch@freebsd.org Received: from ringworld.nanolink.com (sentinel.office1.bg [195.24.48.182]) by hub.freebsd.org (Postfix) with SMTP id 4B30137B401 for ; Fri, 6 Jul 2001 02:34:34 -0700 (PDT) (envelope-from roam@ringworld.nanolink.com) Received: (qmail 656 invoked by uid 1000); 6 Jul 2001 09:38:40 -0000 Date: Fri, 6 Jul 2001 12:38:40 +0300 From: Peter Pentchev To: arch@FreeBSD.org Cc: hardware@FreeBSD.org Subject: New hw.cpuhz sysctl as per PR i386/27627 Message-ID: <20010706123840.A598@ringworld.oblivion.bg> Mail-Followup-To: arch@FreeBSD.org, hardware@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, 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 appended 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-arch" in the body of the message