[Openswan dev] Small optimisation for lots of interfaces

Herbert Xu herbert at gondor.apana.org.au
Fri Nov 25 12:39:34 CET 2005


David McCullough <davidm at snapgear.com> wrote:
> 
> Actually,  I think that it is more likely to be the fact that it opens
> /proc/net/dev and parses it for every interface,  just so it can show
> the "stats" for the interfaces.  At least my quick look at the ifconfig code
> suggests this is the case.

You must be using a different ifconfig than me.  Mine opens it only once
but does this many ioctls for each interface:

4545  1132882691.760015 ioctl(4, 0x8913, 0xbffff8dc) = 0
4545  1132882691.760146 ioctl(4, 0x8927, 0xbffff8dc) = 0
4545  1132882691.760274 ioctl(4, 0x891d, 0xbffff8dc) = 0
4545  1132882691.760401 ioctl(4, 0x8921, 0xbffff8dc) = 0
4545  1132882691.760528 ioctl(4, 0x8970, 0xbffff8dc) = 0
4545  1132882691.760654 ioctl(4, 0x8970, 0xbffff8dc) = 0
4545  1132882691.760781 ioctl(4, 0x8942, 0xbffff8dc) = 0
4545  1132882691.760908 ioctl(4, 0x8915, 0xbffff8dc) = 0
4545  1132882691.761037 ioctl(4, 0x8917, 0xbffff8dc) = 0
4545  1132882691.761165 ioctl(4, 0x8919, 0xbffff8dc) = 0
4545  1132882691.761293 ioctl(4, 0x891b, 0xbffff8dc) = 0

How long does

cat /proc/net/dev > /dev/null

take?

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


More information about the Dev mailing list