trafgen: keep a small initial ring buffer size to reduce cache-misses
commitc10621e6fa8de50619d7dd28546dd3288f053ab8
authorDaniel Borkmann <dborkman@redhat.com>
Wed, 26 Mar 2014 15:28:47 +0000 (26 16:28 +0100)
committerDaniel Borkmann <dborkman@redhat.com>
Wed, 26 Mar 2014 15:35:36 +0000 (26 16:35 +0100)
tree7ddd1e3fa87c8cce6348404163b5c266b4d8e1f6
parentc139e809f8562a2e9a1e24e86abc5a7c6eee6254
trafgen: keep a small initial ring buffer size to reduce cache-misses

Heavily reduce the initial ring buffer size for trafgen to just 196KiB,
so that we can heavily reduce the number of cache-misses related to
cache references. People can still overwrite this setting later on via
command line option for their specific architecture if they wish.

Perhaps the RX_RING should be checked as well in netsniff-ng though the
use case there is slightly different.

Before:

 Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000':

   137,765,493,346 instructions:k            #    0.82  insns per cycle
   167,438,826,578 cycles:k                  #    0.000 GHz
        59,508,315 branch-misses:k
               361 context-switches:k
                 6 cpu-migrations:k
       134,751,541 cache-misses:k            #   85.019 % of all cache refs
       158,495,358 cache-references:k
               755 kmem:kmem_cache_alloc

      15.139458202 seconds time elapsed

After:

 Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000':

   137,889,782,650 instructions:k            #    0.92  insns per cycle
   150,239,185,971 cycles:k                  #    0.000 GHz
        71,583,573 branch-misses:k
               423 context-switches:k
                 7 cpu-migrations:k
            60,239 cache-misses:k            #    0.073 % of all cache refs
        82,502,468 cache-references:k
               740 kmem:kmem_cache_alloc

      12.028787964 seconds time elapsed

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen.c