From owner-freebsd-arch Fri Nov 17 10:30: 5 2000 Delivered-To: freebsd-arch@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id A18D537B479 for ; Fri, 17 Nov 2000 10:30:02 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by pike.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id eAHITMB96213; Fri, 17 Nov 2000 10:29:24 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200011171053.eAHArq488675@zibbi.icomtek.csir.co.za> Date: Fri, 17 Nov 2000 10:30:03 -0800 (PST) From: John Baldwin To: John Hay Subject: Re: new monotime() call for all architectures. Cc: arch@FreeBSD.org, (Mark Murray) Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 17-Nov-00 John Hay wrote: >> >> I need a fast-as-possible "time" inside the kernel to help >> speed up the /dev/random device. I say "time", because although >> it needs to be a function of time (preferably accurate and linear), >> it has no need whatsoever to be "real time", so a simple counter >> is quite OK. >> >> Pentiums, Alphas and IA64's all have a suitable register on chip, >> while I have to make do with nanotime(9) on i386 and i486. >> >> I have prepared a monotime(9) call for the i386, alpha and ia64 >> architectures (patch enclosed). I have been running this for a >> week or two now with promising results (on a Pentium). With >> the exception of the minimum of "glue" (and nanotime on older >> architectures), these functions reduce to one instruction. >> > > Are you sure it will work on SMP machines? There is nothing that > synchronizes the onboard counters. Or will your code stay on one > cpu? It doesn't matter. He just needs a psuedo-timestamp for entropy gathering purposes. It dosen't need to be entirely precise, so if different CPU's counters are not 100% in sync it won't hurt anything. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message