]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pfring: improve profiling
authorVictor Julien <victor@inliniac.net>
Tue, 31 May 2016 12:18:04 +0000 (14:18 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 31 May 2016 12:48:46 +0000 (14:48 +0200)
Reset packet profiling after pfring_recv. The packet was taken from
the packet pool before this call. The packet will already have it's
start ticks initialized. To avoid including ticks while pfring_recv
waits for traffic, reset the ticks right after it.

src/source-pfring.c

index 655031fb71f867801c590a81beeb610521fb2f2b..5cee51344aded9abdd62da87c43b49b92f6a7aa5 100644 (file)
@@ -48,6 +48,7 @@
 #include "util-device.h"
 #include "util-host-info.h"
 #include "runmodes.h"
+#include "util-profiling.h"
 
 #ifdef __SC_CUDA_SUPPORT__
 
@@ -355,6 +356,10 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot)
         }
 
         if (likely(r == 1)) {
+            /* profiling started before blocking pfring_recv call, so
+             * reset it here */
+            PACKET_PROFILING_RESTART(p);
+
             //printf("RecievePfring src %" PRIu32 " sport %" PRIu32 " dst %" PRIu32 " dstport %" PRIu32 "\n",
             //        hdr.parsed_pkt.ipv4_src,hdr.parsed_pkt.l4_src_port, hdr.parsed_pkt.ipv4_dst,hdr.parsed_pkt.l4_dst_port);