Date: 01 May 2001 10:56:27 +0100 From: Rolf Neugebauer <neugebar@dcs.gla.ac.uk> To: freebsd-alpha@FreeBSD.ORG Subject: Re: determine cycle counter frequency in user space Message-ID: <ysqpudt9yus.fsf@therese.dcs.gla.ac.uk> In-Reply-To: Terry Lambert's message of "Mon, 30 Apr 2001 21:47:48 %2B0000 (GMT)" References: <200104302147.OAA12404@usr01.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert <tlambert@primenet.com> writes: > > 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. Not on my 4.2-STABLE, late February vintage. I could parse hw.model, but that reports 533MHz, while dmesg reports 531MHz. In a followup, Mike mentioned fluctuations of clock frequency. Any idea, by how much this fluctuation can be? percentage of MHz, kHz? In general, I am not too fussed about these fluctuations, as I can take some fine grained samples using cycle counters together with more coarse grained once obtained from gettimeofday(). However, to get an estimate for cycles per second, I was looking for a programmatic way to access above mentioned variables instead of providing them as command line arguments. I'll just add an appropriate sysctl to get cycles_per_sec. If people are interested, I'll submit a patch. Thanks Rolf 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?ysqpudt9yus.fsf>