Date: Thu, 28 Jan 1999 11:28:55 -0800 (PST) From: Julian Elischer <julian@whistle.com> To: zhihuizhang <bf20761@binghamton.edu> Cc: hackers <freebsd-hackers@FreeBSD.ORG> Subject: Re: Question concerning timer and rdtsc Message-ID: <Pine.BSF.4.05.9901281127100.304-100000@s204m82.isp.whistle.com> In-Reply-To: <Pine.SOL.L3.93.990127222926.9143A-100000@bingsun1>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901281127100.304-100000>