From: Victor Julien Date: Fri, 16 Jan 2015 11:12:38 +0000 (+0100) Subject: tcp: add debug stats about reassembly fast paths X-Git-Tag: suricata-2.1beta4~223 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37b56dca5570313a0bee6f19d1955f8baf40b926;p=thirdparty%2Fsuricata.git tcp: add debug stats about reassembly fast paths Only shown if --enable-debug is passed to configure. --- diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index b61748dd10..e3ee004875 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -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; diff --git a/src/stream-tcp-reassemble.h b/src/stream-tcp-reassemble.h index b66334a999..686c2e47d9 100644 --- a/src/stream-tcp-reassemble.h +++ b/src/stream-tcp-reassemble.h @@ -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