cvs commit: src/sys/net bpf.c
Jung-uk Kim
jkim at FreeBSD.org
Tue Jul 25 20:11:59 UTC 2006
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
More information about the cvs-src
mailing list