Subject: Re: Interface traffic timestamps
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 06/11/2004 11:35:07
--Apple-Mail-20--849958917
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Jun 11, 2004, at 10:46 AM, Jonathan Stone wrote:

> I'd say: please don't even try to do this on gigabit or 10GbE links;
> the performance hit simply isn't worth it.  (My back-of-the-finger
> estimate leaves me suspecting mono-time is too coarse to be useful.
>
> Or turn it around: bumping a microsecond mono_time once per input
> frame, when frames are only 50 ns long, is going to completely stuff
> up your time-keeping.

I think he's saying he wants to copy mono_time into the timestamp when 
a packet is accepted.  Not increment mono_time.  mono_time is perfectly 
sufficient for the type of application he's talking about (where the 
user generally cares about "seconds", not even "microseconds").

That said, I too am concerned about the overhead of copying mono_time 
on high-speed links ... to do it correctly, you actually need to do:

	s = splclock()
	timestamp = mono_time;
	splx(s);

...although there are places where we skip the spl frobbing because 
accuracy is not really required, just "ballpark".

> Please consider that a very loud objection. :-/.  To me, that suggests
> a per-interface flag, to control whether to do the mono_time
> timestamps, or not.

So we add the overhead of testing the flag each time, too?  :-)  Test 
and branch might be as or more expensive than just doing the memory 
loads/stores (which are likely to hit the cache if done frequently 
enough).

> Alternatively: is the seconds portion of (mono_)time good enough for
> your purposes? Do you really care about microseconds or milliseconds,
> for whether to drop a connect-time-charged ISDN line?

Yah, perhaps seconds is good enough ... then you pretty much definitely 
do not have to worry about spl frobbing for a decent "ballpark" 
timestamp.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


--Apple-Mail-20--849958917
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFAyftbOpVKkaBm8XkRAltDAJ9+9S0ue+ebfNWFc8HcX83AKg+OVQCgtz3Y
QuG5AKPKjBIAM5YdkCo0/tk=
=QZAB
-----END PGP SIGNATURE-----

--Apple-Mail-20--849958917--