From owner-freebsd-hackers Thu Jan 28 09:40:11 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA17080 for freebsd-hackers-outgoing; Thu, 28 Jan 1999 09:40:11 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bingsun1.cc.binghamton.edu (bingsun1.cc.binghamton.edu [128.226.1.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA16990 for ; Thu, 28 Jan 1999 09:40:00 -0800 (PST) (envelope-from bf20761@binghamton.edu) Received: from localhost (bf20761@localhost) by bingsun1.cc.binghamton.edu (8.8.7/8.6.9) with SMTP id MAA08188 for ; Thu, 28 Jan 1999 12:39:40 -0500 (EST) Date: Thu, 28 Jan 1999 12:39:39 -0500 (EST) From: zhihuizhang X-Sender: bf20761@bingsun1 Reply-To: zhihuizhang To: hackers Subject: Question concerning timer and rdtsc 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 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: 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