Date: Mon, 30 Apr 2001 21:47:48 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: neugebar@dcs.gla.ac.uk (Rolf Neugebauer) Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: determine cycle counter frequency in user space Message-ID: <200104302147.OAA12404@usr01.primenet.com> In-Reply-To: <ysqwv83aeun.fsf@therese.dcs.gla.ac.uk> from "Rolf Neugebauer" at Apr 29, 2001 04:46:24 PM
next in thread | previous in thread | raw e-mail | index | archive | help
> I try to determine the cycle counter frequency from a user space > program to do some accurate time counting. Ideally, I would like to > access the rpb_cc_freq field Hardware Restart Parameter Block (rpb) as > possible under OSF/1 using getsysinfo(2) or the calibrated > cycles_per_sec variable from sys/alpha/alpha/machdep.c. > > While it would be easy to introduce a new sysctl or similar, I was > wondering if there is already a 'standard' way under FreeBSD to access > this information (ideally, also under ix86). > > I searched around a bit, but couldn't find any obvious way. The closest you will find is hw.cpu_mhz, via sysctl. I am personally not very happy at all with what has happened to the clock code; what used to be a direct reference to "curtime" is now a convoluted mess requiring a dead chicken and some pagan incantations to achieve the same thing, at the same time making gettimeofday() inordinately expensive. It also bothers me that the standard system clock doesn't use the cycle counter, and instead is rn of the i8254 interrupt, which bothers me no end. If you could get a baseline and a frequency in user space, it would be very easy to implement gettimeofday() in user space, if things were not so strange. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104302147.OAA12404>