]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling: fix profiling with sample rate
authorEric Leblond <el@stamus-networks.com>
Wed, 17 Nov 2021 15:43:23 +0000 (16:43 +0100)
committerJeff Lucovsky <jeff@lucovsky.org>
Sat, 15 Jan 2022 13:01:17 +0000 (08:01 -0500)
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

index 3fbcd6b6a48c7353653faa1cb20a1a16356c1119..b0b7551d1e7f4e768bcbaeac4bd1eea7bb2e16a8 100644 (file)
@@ -1246,6 +1246,8 @@ int SCProfileRuleStart(Packet *p)
         return 1;
     }
 #endif
+    if (p->flags & PKT_PROFILE)
+        return 1;
     return 0;
 }