From owner-freebsd-alpha Tue May 1 8:18:30 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 8EC2A37B422 for ; Tue, 1 May 2001 08:18:25 -0700 (PDT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id LAA12278; Tue, 1 May 2001 11:18:24 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.3/8.9.1) id f41FHsf58190; Tue, 1 May 2001 11:17:54 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15086.54178.150721.633298@grasshopper.cs.duke.edu> Date: Tue, 1 May 2001 11:17:54 -0400 (EDT) To: Rolf Neugebauer Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: determine cycle counter frequency in user space In-Reply-To: References: <200104302147.OAA12404@usr01.primenet.com> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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