From owner-freebsd-hackers Thu Jan 28 11:32:32 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA29335 for freebsd-hackers-outgoing; Thu, 28 Jan 1999 11:32:32 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA29309 for ; Thu, 28 Jan 1999 11:32:26 -0800 (PST) (envelope-from julian@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id LAA10229; Thu, 28 Jan 1999 11:29:03 -0800 (PST) Received: from s204m82.isp.whistle.com(207.76.204.82) via SMTP by alpo.whistle.com, id smtpdr10222; Thu Jan 28 19:29:00 1999 Date: Thu, 28 Jan 1999 11:28:55 -0800 (PST) From: Julian Elischer X-Sender: julian@s204m82.isp.whistle.com To: zhihuizhang cc: hackers Subject: Re: Question concerning timer and rdtsc In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 28 Jan 1999, zhihuizhang wrote: > > I am reading 2.2.8 Stable source code and have two questions about the > timer and rdtsc instruction: > > (1) In file clock.c, timer0_state has four possible values: RELEASED, > RELEASE_PENDING, ACQUIRED, and ACQUIRE_PENDING. I can not figure out the > usage of these four states. Moreover, I tried to see how the variable is > changed in the source code. It seems to me that it can only has the value > of RELEASED (0). Who is going to change it? For what purpose? > > (2) rdtsc is used in microtime to get the internal counter. This value is > related to the Mhz of CPU (and the Mhz may be different, say 133, 300, > etc). We must convert it to microseconds, right? In microtime, this is > done by multiplying a variable i586_ctr_multiplier. I tried to figure out > how the variable is initialized, but it does not make sense to me. The > statement that does the initialization is: No it is not necessarily using the CPU counter.. if it does, then the speeds are calibrated during boot (check the bot message) there are other coulters it can use (e.g. timer0) too. > > multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; > > and i586_freq is often given as the return value of rdtsc(). > > Thanks for any help. > > -------------------------------------------------- > | Zhihui Zhang, http://cs.binghamton.edu/~zzhang | > | Dept. of Computer Science, SUNY at Binghamton | > -------------------------------------------------- > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message