]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tcp: add debug stats about reassembly fast paths
authorVictor Julien <victor@inliniac.net>
Fri, 16 Jan 2015 11:12:38 +0000 (12:12 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 4 Feb 2015 10:23:46 +0000 (11:23 +0100)
Only shown if --enable-debug is passed to configure.

src/stream-tcp-reassemble.c
src/stream-tcp-reassemble.h

index b61748dd105936fc13deeb7fd96247ce9d08c453..e3ee0048753e009012932da28be276f96e14d13e 100644 (file)
@@ -551,6 +551,10 @@ void StreamTcpReassembleFreeThreadCtx(TcpReassemblyThreadCtx *ra_ctx)
 {
     SCEnter();
     AppLayerDestroyCtxThread(ra_ctx->app_tctx);
+#ifdef DEBUG
+    SCLogDebug("reassembly fast path stats: fp1 %"PRIu64" fp2 %"PRIu64" sp %"PRIu64,
+            ra_ctx->fp1, ra_ctx->fp2, ra_ctx->sp);
+#endif
     SCFree(ra_ctx);
     SCReturn;
 }
@@ -2581,7 +2585,9 @@ static inline int DoReassemble(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         AppLayerProfilingStore(ra_ctx->app_tctx, p);
         rd->data_sent += seg->payload_len;
         rd->ra_base_seq += seg->payload_len;
-
+#ifdef DEBUG
+        ra_ctx->fp1++;
+#endif
         /* if after the first data chunk we have no alproto yet,
          * there is no point in continueing here. */
         if (!StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream)) {
@@ -2598,7 +2604,9 @@ static inline int DoReassemble(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         AppLayerProfilingStore(ra_ctx->app_tctx, p);
         rd->data_sent += seg->payload_len;
         rd->ra_base_seq += seg->payload_len;
-
+#ifdef DEBUG
+        ra_ctx->fp2++;
+#endif
         /* if after the first data chunk we have no alproto yet,
          * there is no point in continueing here. */
         if (!StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream)) {
@@ -2607,7 +2615,9 @@ static inline int DoReassemble(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         }
         return 1;
     }
-
+#ifdef DEBUG
+    ra_ctx->sp++;
+#endif
     uint16_t payload_offset = 0;
     uint16_t payload_len = 0;
 
index b66334a9999b5a59b9f1ec369a6f70a50556f524..686c2e47d90524a76e6ecb2520bf49cb09f0008e 100644 (file)
@@ -66,6 +66,11 @@ typedef struct TcpReassemblyThreadCtx_ {
     uint16_t counter_htp_memuse;
     /* number of allocation failed due to memcap when handling HTTP protocol */
     uint16_t counter_htp_memcap;
+#ifdef DEBUG
+    uint64_t fp1;
+    uint64_t fp2;
+    uint64_t sp;
+#endif
 } TcpReassemblyThreadCtx;
 
 #define OS_POLICY_DEFAULT   OS_POLICY_BSD