Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 1999 12:39:39 -0500 (EST)
From:      zhihuizhang <bf20761@binghamton.edu>
To:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Question concerning timer and rdtsc
Message-ID:  <Pine.SOL.L3.93.990127222926.9143A-100000@bingsun1>

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.L3.93.990127222926.9143A-100000>