]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Make AppLayerProfiling functions inline 1184/head
authorKen Steele <ken@tilera.com>
Mon, 6 Oct 2014 15:40:58 +0000 (11:40 -0400)
committerVictor Julien <victor@inliniac.net>
Sat, 25 Oct 2014 18:26:53 +0000 (20:26 +0200)
The entire body of these functions are protected by ifdef PROFILING.
If the functions are inlined, then this check removes the need for the
function entirely.

Previously, the empty function was still called, even when not built
for profiling. The functions showed as being 0.25% of total CPU time
without being built for profiling.

src/app-layer.c
src/app-layer.h

index 4c7770c1ac13834fd3ab243b9ec2a137ff941528..77c2d4f95ae2dc26ab085303f1fdee4a403c52ae 100644 (file)
@@ -656,20 +656,14 @@ void AppLayerDestroyCtxThread(AppLayerThreadCtx *app_tctx)
     SCReturn;
 }
 
-/* profiling */
-
-void AppLayerProfilingReset(AppLayerThreadCtx *app_tctx)
+void AppLayerProfilingResetInternal(AppLayerThreadCtx *app_tctx)
 {
-#ifdef PROFILING
     PACKET_PROFILING_APP_RESET(app_tctx);
-#endif
 }
 
-void AppLayerProfilingStore(AppLayerThreadCtx *app_tctx, Packet *p)
+void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *p)
 {
-#ifdef PROFILING
     PACKET_PROFILING_APP_STORE(app_tctx, p);
-#endif
 }
 
 /***** Unittests *****/
index 5d4f51ca32117d23d4260de6bfcc02a9d56a9ead..ca221d2dc1d8ba1604d3396793b829c59fdf91ac 100644 (file)
@@ -31,6 +31,8 @@
 #include "stream-tcp-reassemble.h"
 #include "stream.h"
 
+#include "util-profiling.h"
+
 #define APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER \
     (~STREAM_TOSERVER & ~STREAM_TOCLIENT)
 
@@ -108,8 +110,26 @@ AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv);
 void AppLayerDestroyCtxThread(AppLayerThreadCtx *tctx);
 
 
-void AppLayerProfilingReset(AppLayerThreadCtx *tctx);
-void AppLayerProfilingStore(AppLayerThreadCtx *tctx, Packet *p);
+/***** Profiling *****/
+
+void AppLayerProfilingResetInternal(AppLayerThreadCtx *app_tctx);
+
+static inline void AppLayerProfilingReset(AppLayerThreadCtx *app_tctx)
+{
+#ifdef PROFILING
+    AppLayerProfilingResetInternal(app_tctx);
+#endif
+}
+
+void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *p);
+
+static inline void AppLayerProfilingStore(AppLayerThreadCtx *app_tctx, Packet *p)
+{
+#ifdef PROFILING
+    AppLayerProfilingStoreInternal(app_tctx, p);
+#endif
+}
+
 
 /***** Unittests *****/