Date: Fri, 17 Nov 2000 21:09:40 +0200 (SAT) From: John Hay <jhay@icomtek.csir.co.za> To: jhb@FreeBSD.ORG (John Baldwin) Cc: arch@FreeBSD.ORG, mark@grondar.za Subject: Re: new monotime() call for all architectures. Message-ID: <200011171909.eAHJ9et99988@zibbi.icomtek.csir.co.za> In-Reply-To: <XFMail.001117103003.jhb@FreeBSD.org> from John Baldwin at "Nov 17, 2000 10:30:03 am"
next in thread | previous in thread | raw e-mail | index | archive | help
> >> 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. Ok, I just thought the "mono" in his function name is for monotonic. If you are staying on one processor it will work, but if the timestamps have scheduling inbetween the timestamps and you land on a different processor it won't be monotonic anymore. John -- John Hay -- John.Hay@icomtek.csir.co.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011171909.eAHJ9et99988>