Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jul 2001 14:00:41 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Peter Pentchev <roam@orbitel.bg>
Cc:        arch@FreeBSD.org, hardware@FreeBSD.org
Subject:   Re: New hw.cpuhz sysctl as per PR i386/27627 
Message-ID:  <200107062100.f66L0fa01267@mass.dis.org>
In-Reply-To: Your message of "Fri, 06 Jul 2001 12:38:40 %2B0300." <20010706123840.A598@ringworld.oblivion.bg> 

next in thread | previous in thread | raw e-mail | index | archive | help

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-arch" in the body of the message




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