Date: Tue, 25 Jul 2006 16:11:25 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: David Malone <dwmalone@maths.tcd.ie> Cc: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, "Christian S.J. Peron" <csjp@FreeBSD.org>, cvs-all@FreeBSD.org, phk@FreeBSD.org, Sam Leffler <sam@errno.com> Subject: Re: cvs commit: src/sys/net bpf.c Message-ID: <200607251611.27316.jkim@FreeBSD.org> In-Reply-To: <200607252039.aa40648@salmon.maths.tcd.ie> References: <200607252039.aa40648@salmon.maths.tcd.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 25 July 2006 03:39 pm, David Malone wrote: > > > It sounds to me like a reasonable thing to do would be to pass > > > up a raw version of the timestamp (as returned by the > > > hardware). We'd also pass up the regular microtime() timestamp. > > > You can then do any postprocessing to syncronise timestamps > > > later in userland? > > > > Nope. In that case, you actually need to export few more things, > > i.e., current hardware timecounter value, clock frequency, size > > of the timecounter, etc. Even then, it's going to be hard to get > > correct timeval without exposing few kernel internals. > > I guess it depends a bit on your requirements. If you have a > sequence of packets and are interested in getting accurate > inter-arrival times, then (providing that the counter doesn't wrap > too often and the frequency is relatively constant) the hardware > counter values and system timestamps of the first and last packets > should be enough to get quite close to what you want. Well, it may not be close enough because between actual packet arrival time and calling microtime() is not always constant. Actually, it's not even close from my experience, not to mention device polling and interrupt moderation issues. :-( Of course, it all depends on device driver and network controller design, though. > (This might even produce better estimates of inter-rival times than > also using the intermediate timestamps, as NTP slewing the clock > can make it hard to get consistent readings. Hence people doing > stuff like this > http://www.imconf.net/imc-2004/papers/p219-veitch.pdf) It is not too easy as I said. BTW, for designing and implementing wonderful API for FreeBSD, we should be thankful for having phk in the team. > You're right though - that's not sufficient for everyone. I really like to have both generic and flexible API. :-) Jung-uk Kim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607251611.27316.jkim>