Date: Tue, 04 Nov 1997 23:45:11 +1030 From: Mike Smith <mike@smith.net.au> To: Charles Mott <cmott@srv.net> Cc: hackers@hub.freebsd.org Subject: Re: gettimeofday() overhead Message-ID: <199711041315.XAA00406@word.smith.net.au> In-Reply-To: Your message of "Tue, 04 Nov 1997 05:30:37 PDT." <Pine.BSF.3.96.971104052448.29917B-100000@darkstar.home>
next in thread | previous in thread | raw e-mail | index | archive | help
> > If you knew where the time was in kernel memory, you could map it > > into your address space and read it. This is what Digital's X > > server does to timestamp X events. > > For some reason, method number 2 intrigues me. Maybe because it > is probably the lowest overhead yet the most accurate. > > How would one go about doing this? Is it dependent on the > specific kernel build, or would there be a means of automatically > locating and mapping the kernel time variable? You could locate an appropriate variable in kernel space using the kernel symbol table. Unfortunately, this requires access to /dev/kmem, and thus your process must be running as root. IMHO this isn't really an acceptable tradeoff unless the application already requires it. OTOH, if +/- 1 second is good enough, a once-a-second timer and a local call to gettimeofday() would be a simple and straightforward technique, as was also suggested. mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711041315.XAA00406>