From 033c4b6f446554488d44af192fce0e603aaeea99 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Wed, 17 Nov 2021 16:43:23 +0100 Subject: [PATCH] profiling: fix profiling with sample rate Rules profiling was returning invalid results when used with sample rate. The problem was that the sample condition was run twice in the packet flow. As a result, the second pass was not initializing the variable storing the initial CPU ticks and the resulting performance counters were reporting invalid values. Bug: #4836. (cherry picked from commit 6d5f59696dda77e1e7b2c45f51413b76690da4e9) --- src/util-profiling.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util-profiling.c b/src/util-profiling.c index cc6d5c0856..3c2e4a36eb 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -1243,6 +1243,8 @@ int SCProfileRuleStart(Packet *p) return 1; } #endif + if (p->flags & PKT_PROFILE) + return 1; return 0; }