]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
A small change to avoid calling gettimeofday() too often
authorLuigi Rizzo <luigi@FreeBSD.org>
Thu, 15 Oct 2009 14:18:35 +0000 (14:18 +0000)
committerLuigi Rizzo <luigi@FreeBSD.org>
Thu, 15 Oct 2009 14:18:35 +0000 (14:18 +0000)
commit54dd21686df08177e6b5dbea46332680d28aac18
tree5975ea7c59ac3207b8f13198a13dfc3426b47d39
parenta0f1535205b5b23672cf0bed68f3e1119a06d44a
A small change to avoid calling gettimeofday() too often
(hardwired to once every 20us at most).

I found out that on many machines round here, i could only get
300-400kpps with netsend even on loopback and a 'deny' rule in
the firewall, while reducing the number of calls to gettimeofday()
brings the value to 900kpps and more.

This code is just a quick fix for the problem. Of course it could be
done better, with proper getopt() parsing and the like, but since
this applies to the entire program i'll postpone that to when i have
more time.

Reviewed by: rwatson
MFC after: 1 month
tools/tools/netrate/netsend/netsend.c