Date: Tue, 1 May 2001 11:17:54 -0400 (EDT) From: Andrew Gallatin <gallatin@cs.duke.edu> To: Rolf Neugebauer <neugebar@dcs.gla.ac.uk> Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: determine cycle counter frequency in user space Message-ID: <15086.54178.150721.633298@grasshopper.cs.duke.edu> In-Reply-To: <ysqpudt9yus.fsf@therese.dcs.gla.ac.uk> References: <200104302147.OAA12404@usr01.primenet.com> <ysqpudt9yus.fsf@therese.dcs.gla.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Rolf Neugebauer writes: > > 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. Depending on how accurate you needed them to be, you might be able to just calculate them. __inline int GetClockCycleFreq(void) { unsigned long t0, t1; int delta_t = -1; do { /* loop to avoid nasty negative cycle counts.. */ t0 = alpha_rpcc(); sleep(1); t1 = alpha_rpcc(); delta_t = t1 - t0; } while (delta_t < 0); return(delta_t); } Drew 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?15086.54178.150721.633298>