Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2001 12:38:40 +0300
From:      Peter Pentchev <roam@orbitel.bg>
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>

next in thread | raw e-mail | index | archive | help
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-hardware" in the body of the message




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